Human-computer interaction method, electronic device, and related apparatus

By constructing a file attribute library and a vector database, electronic devices can make recommendations to users based on the attributes and content of local files, solving the problem of limited application scope in existing technologies, achieving more accurate and complete recommendations, and improving the user experience.

WO2026091969A1PCT designated stage Publication Date: 2026-05-07HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-09-19
Publication Date
2026-05-07

AI Technical Summary

Technical Problem

Existing input association methods are based on general knowledge bases or user history input, which have a limited scope of application and restricted application scenarios. They cannot effectively utilize the file attributes and content of local files for recommendations.

Method used

Electronic devices make recommendations to users by building a file attribute library and a vector database, using file attributes and file content, including the file attribute content of named entities in the file attribute library and the question answer with the highest vector similarity in the vector database.

Benefits of technology

It improves the accuracy and completeness of recommendations, expands the application scenarios of human-computer interaction, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025122723_07052026_PF_FP_ABST
    Figure CN2025122723_07052026_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a human-computer interaction method, an electronic device, and a related apparatus. The method comprises: an electronic device receiving an input from a user, and when a named entity is present in the input, outputting a first recommendation result on the basis of a file attribute library, wherein the first recommendation result is content of a first file attribute of the named entity in the file attribute library, and the file attribute library is obtained on the basis of file attributes of a local file; and when there is no named entity in the input, outputting a second recommendation result on the basis of a vector database, wherein the vector database is obtained on the basis of file content of the local file, the vector database is used for indicating questions related to the file content, and the second recommendation result is an answer to the question having the highest similarity to the input. The electronic device can make recommendations to a user on the basis of a local file, thereby expanding application scenarios. In addition, the electronic device can make recommendations to the user on the basis of file attributes and file content of the local file, thereby improving the accuracy and completeness of recommendation and improving user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Human-computer interaction methods, electronic devices and related apparatus

[0001] This application claims priority to Chinese patent application filed on October 30, 2024, with application number 202411536006.0 and entitled "Human-computer interaction method, electronic device and related apparatus", the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of human-computer interaction technology, and in particular to a human-computer interaction method, electronic device, and related apparatus. Background Technology

[0003] To improve the user's input experience, input suggestion methods are currently used to assist the user's input. For example, when a user inputs text using an input method, the input method can suggest words or sentences based on the text the user has already entered. The user can then choose from the suggested words or sentences, which simplifies the input process and reduces the user's input time.

[0004] Currently, commonly used input association methods are based on general knowledge bases or users' historical input, which have a small scope of application and limited application scenarios. Summary of the Invention

[0005] This application provides a human-computer interaction method, electronic device, and related apparatus, which can expand the application scenarios and scope of human-computer interaction.

[0006] Firstly, this application provides a human-computer interaction method that can be applied to input association scenarios and question-and-answer scenarios. This application does not limit the applicable scenarios. The executing entity of this human-computer interaction method can be an electronic device or a chip within an electronic device; the following description uses an electronic device as an example. In this method, the electronic device receives user input. When the input contains a named entity, the electronic device can output a first recommendation result based on a file attribute library. A named entity can be understood as a specific type of entity, and the file attribute library is obtained based on the file attributes of local files. For example, the file attribute library can store at least one file attribute of a local file. In this example, the input can correspond to the first file attribute in the file attribute library, and correspondingly, the first recommendation result is the content of the first file attribute of the named entity in the file attribute library.

[0007] When no named entities exist in the input, the electronic device can output a second recommendation result based on a vector database. This vector database is derived from the content of local files and indicates questions related to the file content. For example, the vector database may include questions related to the file content or the vectors corresponding to those questions. In this example, the second recommendation result is the answer corresponding to the question with the highest similarity to the input.

[0008] In this embodiment, the electronic device can make recommendations to users based on local files, which can expand the application scenarios. Furthermore, the electronic device can make recommendations to users based on the file attributes and content of local files, depending on whether there are named entities in the input, which can improve the accuracy and completeness of the recommendations and enhance the user experience.

[0009] The following describes the process by which electronic devices make recommendations to users based on file attribute libraries and vector databases:

[0010] Firstly: File attribute library

[0011] The electronic device checks if a file attribute matching the input exists in the file attribute database. When a matching file attribute exists, the electronic device can query the database for the content of the first file attribute of the named entity and use that content as the first recommended result.

[0012] In one possible implementation, the file attribute matching the input specifically refers to a file attribute matching the input topic. In this implementation, the electronic device can obtain the input topic and check if a file attribute matching the input topic exists in the file attribute database. When a file attribute matching the input topic exists in the file attribute database, the electronic device can query the content of the first file attribute of the named entity in the file attribute database and use that content as the first recommendation result.

[0013] In one possible implementation, when no matching file attribute exists in the file attribute library, the electronic device can output a second recommendation result based on the vector database, as described in "Second".

[0014] Currently, there is no method for making recommendations to users based on file attributes in existing technical solutions. In this implementation, electronic devices can make recommendations to users based on the file attributes of local files, which can improve the accuracy and completeness of recommendations and enhance the user experience.

[0015] Secondly: Vector database

[0016] The vector database includes vectors of questions related to the file content, and the question-and-answer database includes questions related to the file content, as well as the corresponding answers. In some embodiments, an electronic device may include both the vector database and the question-and-answer database.

[0017] When no named entities exist in the input, the electronic device can vectorize the input to obtain an input vector. Then, it retrieves the first vector with the highest similarity to the input vector from a vector database. The question-and-answer database includes questions related to the file content and their corresponding answers. The electronic device can retrieve the answer to the question corresponding to the first vector from the question-and-answer database, and then use that answer as the second recommendation result.

[0018] In this implementation, the electronic device can process the input using vector processing, and recommend the answer to the question corresponding to the first vector with the highest similarity to the input vector to the user. That is, recommending the answer to the question most similar to the input to the user can improve the accuracy of the recommendation and improve the user experience.

[0019] In one possible implementation, the user's input can be referred to as the first input. After receiving the first input, the electronic device can further detect whether the first input includes a trigger word. If the first input does not include a trigger word, the electronic device can continue to detect whether subsequent user inputs include trigger words. If the first input includes a trigger word, in some embodiments, the electronic device can execute the human-computer interaction method described above in this application.

[0020] In this implementation, trigger words can be pre-configured. In response to the presence of a trigger word in the input, the electronic device can execute the human-computer interaction method provided in this application embodiment, which can reduce the processing load and power consumption of the electronic device.

[0021] In some embodiments, if the first input includes a trigger word, the electronic device can perform referential resolution on the first input to obtain the second input. Referential resolution can be understood as the electronic device converting pronouns in the first input into named entities based on the context of the first input.

[0022] In this implementation, the electronic device can combine the context of the input to perform referential resolution, which can accurately identify named entities in the input and improve recommendation accuracy.

[0023] In one possible implementation, the electronic device can perform referential resolution on the last sentence in the first input based on the punctuation marks in the first input, and the second input is the last sentence after referential resolution.

[0024] In this implementation, the electronic device performs substitution and resolution on the last sentence in the first input, rather than performing substitution and resolution on the entire first input. This reduces the processing load of the electronic device while ensuring accurate input determination.

[0025] Accordingly, when the electronic device receives a second input, it can make recommendations to the user based on that second input. Specifically, if the second input contains named entities, the electronic device can output a first recommendation result based on a file attribute database. If the second input does not contain named entities, the electronic device can output a second recommendation result based on a vector database. It should be understood that the process by which the electronic device makes recommendations to the user based on the file attribute database and the vector database can be referred to the description in the above implementation method.

[0026] In some embodiments, the electronic device may pre-process local files to obtain and store a file attribute database, a question-and-answer database, and a vector database, so as to implement the human-computer interaction method described above when the electronic device interacts with the user. The process by which the electronic device processes local files to obtain the file attribute database, question-and-answer database, and vector database is described below:

[0027] Firstly: File attribute library

[0028] In one possible implementation, file attributes for various file types can be predefined. The electronic device can then retrieve the file attributes of local files based on these predefined attributes and the file type of the local file. By combining these local file attributes, the electronic device can build a file attribute library.

[0029] Secondly: Question-answering databases and vector databases

[0030] The electronic device can read the content of a local file and input the file content along with a first preset prompt word into a large language model to obtain the key sentences of the local file. The first preset prompt word instructs the large language model to output key sentences containing named entities. After obtaining the key sentences of the local file, the electronic device can identify the named entities within the key sentences and construct question-answer pairs. The electronic device can then construct a question-answer database based on these pairs, which includes multiple question-answer pairs. Furthermore, the electronic device can construct a vector database based on the questions within the question-answer pairs, which can include vectors of the questions from multiple question-answer pairs. For example, the electronic device can vectorize the questions in a question-answer pair to obtain question vectors.

[0031] In one possible implementation, when a named entity exists in a key sentence, the electronic device can ask a question about the named entity in the key sentence to obtain the question in the question-answer pair, and use the content of the named entity in the key sentence as the answer to the question in the question-answer pair.

[0032] In one possible implementation, when a key sentence contains multiple named entities that are different, the electronic device can ask questions for each named entity, resulting in multiple question-answer pairs. For example, the electronic device can ask questions for each named entity in the key sentence, obtaining questions in multiple question-answer pairs, and using the content of the named entity in the key sentence as the answer to the question in the corresponding question-answer pair.

[0033] In one possible implementation, when a key sentence contains multiple named entities that are identical, the electronic device can determine whether there is a connector between the named entities. When a connector exists between named entities, it indicates that the key sentence is used to indicate changes in the numerical values ​​of the named entities. The electronic device can then ask questions about the named entities in the key sentence to obtain the question in the question-and-answer pair, and use the content of the multiple named entities in the key sentence, along with the connector, as the answer to the question in the question-and-answer pair.

[0034] In this way, electronic devices can construct question-answer pairs in different ways depending on the number of named entities in the key sentences and whether the results are the same, which can ensure the accuracy of the question-answer pairs and improve the accuracy of the constructed question-answer database and vector database.

[0035] In one possible implementation, after obtaining the file attribute library, question-and-answer database, and vector database, the electronic device considers that users may edit and modify the content of local files. After the content of local files is modified, the questions and / or answers in the question-and-answer pairs will also change. In order to avoid the electronic device recommending incorrect words or sentences to users, the electronic device can update the question-and-answer database and vector database when the local files are updated.

[0036] In this implementation, in response to an update to the content of a local file, the electronic device can input the updated content and a first preset prompt word into a large language model to obtain the key sentences of the updated content. It then identifies named entities within these key sentences and constructs question-answer pairs. The electronic device can determine whether there exists a question in the question-answer data that has the same semantic meaning as the question in the question-answer pair of the updated content. Specifically, when a question exists in the question-answer data that has the same semantic meaning as the question in the question-answer pair of the updated content, if the update type is adding or modifying content, the electronic device can replace the semantically identical question-answer pair in the question-answer database with the updated content's question-answer pair. Conversely, if the update type is deleting content, the electronic device can delete the updated content's question-answer pair from the question-answer database.

[0037] Specifically, when there is no question in the question-and-answer data that has the same semantic meaning as the question in the question-and-answer pair of the updated content, if the update type is "add content", the electronic device can add the question-and-answer pair of the updated content to the question-and-answer database. If the update type is "modify content", the electronic device can replace the question-and-answer pair of the updated content with the question-and-answer pair of the same semantic meaning in the question-and-answer database.

[0038] In this implementation, in response to the user updating the content of local files, the electronic device can update the question-answer pairs in the question-answer database in a timely manner, which can ensure the accuracy of the question-answer database.

[0039] In one possible implementation, the question in the question-and-answer pair of the updated content is the first question, and the question in the question-and-answer database is the second question. Before determining whether there is a question in the question-and-answer data that has the same semantics as the question in the question-and-answer pair of the updated content, the electronic device can obtain the similarity between the first question and each second question, and select the second question with the highest similarity as the third question. Accordingly, the electronic device's determination of whether there is a question in the question-and-answer data that has the same semantics as the question in the question-and-answer pair of the updated content can be understood as: the electronic device determining whether the first question and the third question have the same semantics.

[0040] In this implementation, the electronic device can first calculate the similarity between the first question and each second question, and then determine the third question that has the highest similarity to the first question among the second questions. This can reduce the number of second questions that the electronic device needs to determine whether they are semantically the same, reduce the processing load of the electronic device, and reduce the power consumption of the electronic device.

[0041] In one possible implementation, the electronic device can input a first question, a third question, and a second preset prompt word into a large language model. The second preset prompt word is predefined and is used to indicate to the large language model whether the semantics of the first question and the third question are the same.

[0042] In this implementation, the electronic device can use a combination of preset prompts and a large language model, so that the large language model outputs whether the semantics of the first question and the third question are the same, which can improve the accuracy of the results.

[0043] In a second aspect, embodiments of this application provide an electronic device, including a processor and a memory, wherein the memory is used to store code instructions and the processor is used to execute the code instructions to perform the methods described in the first aspect or any possible implementation thereof.

[0044] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the methods described in the first aspect or any possible implementation thereof.

[0045] Fourthly, embodiments of this application provide a computer program product including a computer program, which, when run on a computer, causes the computer to perform the methods described in the first aspect or any possible implementation of the first aspect.

[0046] Fifthly, this application provides a chip or chip system including at least one processor and a communication interface. The communication interface and the at least one processor are interconnected via a circuit. The at least one processor is used to run computer programs or instructions to perform the methods described in the first aspect or any possible implementation thereof. The communication interface in the chip can be an input / output interface, pins, or circuits, etc.

[0047] In one possible implementation, the chip or chip system described above in this application further includes at least one memory storing instructions. The memory can be an internal storage unit of the chip, such as a register or cache, or it can be a storage unit of the chip itself (e.g., read-only memory, random access memory, etc.).

[0048] It should be understood that the second to fifth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description

[0049] Figure 1 is a schematic diagram of an input association based on a general knowledge base;

[0050] Figure 2 is a schematic diagram of an input association based on historical input;

[0051] Figure 3 is a schematic flowchart of a local file processing embodiment provided in this application;

[0052] Figure 4 is a schematic diagram of a process for constructing a vector database according to an embodiment of this application;

[0053] Figure 5 is a schematic diagram of a process for updating a question-and-answer database and a vector database according to an embodiment of this application;

[0054] Figure 6 is a flowchart illustrating an embodiment of the human-computer interaction method provided in this application.

[0055] Figure 7 is a schematic diagram of a scenario of the human-computer interaction method provided in an embodiment of this application;

[0056] Figure 8 is a schematic diagram of another scenario of the human-computer interaction method provided in the embodiments of this application;

[0057] Figure 9 is a schematic diagram of another scenario of the human-computer interaction method provided in the embodiments of this application;

[0058] Figure 10 is a flowchart illustrating another embodiment of the human-computer interaction method provided in this application.

[0059] Figure 11 is a schematic diagram of input processing according to an embodiment of this application;

[0060] Figure 12 is a schematic diagram of another scenario of the human-computer interaction method provided in the embodiments of this application;

[0061] Figure 13 is a flowchart illustrating another embodiment of the human-computer interaction method provided in this application.

[0062] Figure 14 is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0063] To facilitate understanding, the relevant terms and concepts involved in the embodiments of this application will be introduced below:

[0064] 1. Large Language Model (LLM): A deep learning model trained on a large amount of text data that can generate natural language text or understand the meaning of language text.

[0065] 2. File: A file is the basic unit used to store and organize data in an electronic device. In this embodiment, a file can contain various types of data, such as program code, text documents, audio files, video files, and image files.

[0066] 3. File Attributes: In this embodiment, file attributes may include at least one of the following: title, author, time, etc. For example, the time may be the file's modification time.

[0067] 4. Entity: An important concept in data models, used to represent specific objects or things in the real world.

[0068] 5. Named Entities: These are entities of a specific type, typically identified by their names. Named entities are an important concept in natural language processing and information extraction. Common named entities include names of people, organizations, places, numbers, dates, currencies, and addresses.

[0069] 6. Reference Resolution: This involves determining the relationship between two objects in the text, that is, defining one object to refer to another object in the context. In the embodiments of this application, reference resolution refers to the process of replacing pronouns in the text with named entities.

[0070] 7. Prompt: This is a guiding text provided during human-computer interaction. In this embodiment, the prompt is used to instruct the LLM to generate output with specific content or following a specific context.

[0071] In some embodiments, the prompt can be set according to the specific business scenario. For example, prompt could be: for a given text, extract numerical information such as date and percentage, and output a shortened sentence that is concise and does not contain extra information, such as [subject][time][numerical information]. In this example, prompt is used to instruct LLM to generate concise output without extra information, such as the format [subject][time][numerical information].

[0072] 8. Electronic equipment:

[0073] The electronic device in this application embodiment is a device storing local files, used to support the human-computer interaction method provided in this application embodiment. The electronic device can be referred to as user equipment (UE), terminal, etc. For example, the electronic device can be a mobile phone, tablet, personal digital assistant (PDA), handheld device with wireless communication function, computing device, in-vehicle device, or wearable device, virtual reality (VR) terminal device, augmented reality (AR) terminal device, wireless terminal in industrial control, wireless terminal in smart home, etc. The form of the electronic device is not specifically limited in this application embodiment.

[0074] Currently, electronic devices can use input association methods to assist user input. Common input association methods are based on general knowledge bases or the user's historical input, but their application scope is limited and application scenarios are restricted. General knowledge bases can include, but are not limited to: people's birthdays, the area of ​​locations, capital cities of countries, provincial capitals, and classical Chinese poems. General knowledge bases are typically stored in the cloud in the form of structured text.

[0075] Figure 1 is a schematic diagram of input association based on a general knowledge base. Referring to Figure 1, after the user enters the text "Guangzhou area" through the input method, the input method can interact with the cloud and recommend words such as "7434.4 km

[0077] " to the user through the general knowledge base. In addition, the input method can also recommend common words such as "is", "how big", "how much" to the user.

[0076] Figure 2 is a schematic diagram of input association based on historical input. Referring to Figure 2, after the user enters the text "today" through the input method, the input method can recommend words with higher input frequencies such as "so happy", "what to eat" to the user based on the text of the user's historical input. It should be understood that in Figures 1 and 2, and the following attached drawings, the electronic device is taken as an example of a mobile phone. In Figures 1 and 2, a chat page is taken as an example.

[0077] The input association method can recommend words or sentences that the user may input to reduce the user's input time and improve the user experience. However, currently, the application scope of association based on the general knowledge base or the user's historical input is small and the application scenarios are limited. In a possible scenario, the user needs the electronic device to perform input association based on local files, such as when the user needs to reference the information of local files when entering text through the input method. However, currently, the user needs to open the relevant local files in the electronic device and search for the corresponding information in the local files to perform input, resulting in low efficiency.

[0078] For example, the electronic device locally stores multiple papers written by the user, and the papers include professional knowledge in a certain technical field. When the user is writing a new paper or document, or when the user is discussing issues with other users in the same technical field through the input method, the user needs the input method to perform input association based on local files. Exemplarily, when the user enters text such as "The papers I wrote have", the user needs the input method to recommend the titles of multiple papers locally stored in the electronic device, so that the user does not need to search for the titles of each paper in the electronic device one by one, which can improve the user's input efficiency.

[0079] In the scenario of human-computer interaction based on local files, in some embodiments, the electronic device can store a local knowledge base, and the local knowledge base can include multiple question-and-answer pairs, and each question-and-answer pair consists of a question and an answer. In this example, in response to the user's input, the electronic device can calculate the semantic similarity between the user's input and each question in the local knowledge base, and the electronic device can recommend the answer corresponding to the question with the highest semantic similarity to the user.

[0080] In this example, although the electronic device uses the local knowledge base to recommend the corresponding answer to the user, the method of this example still has the following problems:

[0081] 1) The local knowledge base contains multiple existing question-answer pairs, while the local files of electronic devices are currently composed of text, audio, video and images, etc., and there are no existing question-answer pairs, so it is not applicable to the scenario of this application.

[0082] 2) The local knowledge base only addresses file content and lacks question-and-answer pairs for file attributes. For example, the local knowledge base lacks question-and-answer pairs for paper titles, authors, and revision dates. When a user enters the text "I have written papers," the electronic device cannot recommend paper titles from local files.

[0083] Accordingly, this application provides a human-computer interaction method. In response to user input, an electronic device can recommend information about local files to the user based on the file attributes and content of the local files. This not only enables input association based on local files, improving user input efficiency, but also, because the electronic device recommends information based on both the file content and file attributes, it improves the accuracy and completeness of the recommendations, thus enhancing the user experience.

[0084] Before introducing the human-computer interaction method provided in the embodiments of this application, we will first introduce the process of electronic devices processing local files:

[0085] Figure 3 is a schematic flowchart illustrating a local file processing method according to an embodiment of this application. Referring to Figure 3, for a local file, the electronic device can parse the file's attributes to obtain a file attribute database. Additionally, the electronic device can parse the content of the local file to obtain a question-and-answer database, or a question-and-answer database and a vector database. It should be understood that Figure 3 illustrates the electronic device obtaining both a question-and-answer database and a vector database as an example.

[0086] The file attribute library may include identifiers and attributes of local files. For example, the file attribute library may include: an identifier for file 1 and attributes for file 1, an identifier for file 2 and attributes for file 2, etc. The attributes of local files will be referred to as file attributes below.

[0087] For example, taking a local file as a text document, file attributes may include, but are not limited to, title, author, and modification time. Taking a local file as an audio file, file attributes may include, but are not limited to, title, author, audio type, and modification time. It is understood that different types of local files may have different file attributes. In this embodiment, file attributes can be predefined for different types of local files so that the electronic device can parse the attributes of the local file to obtain a file attribute library.

[0088] The question-and-answer database may include multiple question-and-answer pairs, which are generated based on the content of local files. For example, file 1 contains content about fruit, and the question-and-answer pairs may include multiple pairs related to fruit. Similarly, file 2 contains content about mobile phones, and the question-and-answer pairs may include multiple pairs related to mobile phones. It should be understood that a question-and-answer pair may include one question and one answer.

[0089] In some embodiments, the question-answering database may include multiple question-answer pairs in text form. In some embodiments, the question-answering database may be referred to as a question-answering dataset.

[0090] In some embodiments, after obtaining the question-and-answer database, the questions and answers in each question-and-answer pair can be vectorized to obtain a vector database.

[0091] In some embodiments, an electronic device may store a file attribute library and a vector database.

[0092] In some embodiments, an electronic device may store a file attribute library and a question-and-answer database.

[0093] In some embodiments, an electronic device may store a file attribute library, a vector database, and a question-and-answer database.

[0094] The following describes the process by which electronic devices parse local files to obtain a file attribute database, a question-and-answer database, and a vector database:

[0095] 1. File Attribute Library

[0096] In this embodiment, file attributes can be predefined for different types of files. For example, for a text document, file attributes can include title, author, modification time, etc.; for an audio file, file attributes can include title, author, audio type, modification time, etc. It is understood that the predefined attributes are unassigned attributes. For example, taking a text document as an example, the attributes of a text document can include: title, author, and modification time.

[0097] Electronic devices can parse the attributes of local files based on predefined file attributes and file types to obtain the attributes of each local file, thus constructing a file attribute library. The file attribute library includes an identifier for each local file and its attributes. It should be understood that the attributes in the file attribute library are assigned values. For example, taking text document 1 as an example, the attributes of text document 1 in the file attribute library may include: title "Fruit xxx", author "Zhang x", and modification time "x year x month x day".

[0098] In some embodiments, for audio and video files, the audio can be converted into text, and this text can have modification attributes such as title, author, and modification time. In some embodiments, for video files and image files, the images can be converted into text, and this text can have modification attributes such as title, author, and modification time. The images in a video file may include each frame of the video.

[0099] 2. Question-answering databases and vector databases

[0100] Considering that document content may contain scattered fragments and semantically incoherent elements, leading to inaccurate content extraction, this application proposes a key content extraction method based on a combination of prompt and entity annotation to improve the accuracy of extracted key content. The method is described in detail below with reference to Figure 4:

[0101] Figure 4 is a schematic diagram of a process for constructing a vector database according to an embodiment of this application. Referring to Figure 4, the process may include:

[0102] S401 reads the contents of a local file.

[0103] It is understandable that the execution entity of S401-S404 in Figure 4 is the electronic device, that is, the electronic device can process the local files of the electronic device to obtain the question-and-answer database and the vector database.

[0104] In some embodiments, the electronic device may read the contents of a local file at preset intervals. In some embodiments, the electronic device may read the contents of a local file once when the local file is updated. The local file update can be described in the following embodiments.

[0105] In some embodiments, the electronic device can read the contents of each local file. In some embodiments, the file type can be pre-specified, and the electronic device can read the contents of local files of the specified type.

[0106] S402: Input the contents of the local file and the preset prompt into the LLM to obtain the key sentences of the local file.

[0107] A preset prompt is used to instruct the LLM to extract key phrases containing named entities from the content of a local file. In some embodiments, the preset prompt instructs the LLM to extract key phrases containing named entities from the content of a local file. These named entities can be predefined and may include, but are not limited to, date, percentage, amount, person's name, place name, organization name, etc.

[0108] For example, a default prompt could be: For the content of a local file, extract numerical values ​​such as date and percentage, and provide a shortened sentence that is concise and does not contain extra information such as [subject][time][numerical information]. Extract as many such sentences as possible and connect them into a single text block using a period (.). Do not return any redundant text. If extraction fails, return "--Unable to process--".

[0109] For example, a local file contains a text fragment that reads, "A summary of domestic new energy passenger vehicle subsidy standards and reduction measures from 2018 to 2022. New energy vehicle subsidies have played a significant role in promoting electrification; this policy will officially end on December 31, 2022." In this embodiment, the electronic device can input this text fragment and a preset prompt into the LLM, and the LLM can output the key sentence containing the time, "The new energy passenger vehicle subsidy policy will end on December 31, 2022."

[0110] In some embodiments, the preset prompt in S402 may be referred to as the first preset prompt word.

[0111] S403 identifies named entities in key sentences and constructs question-answer pairs.

[0112] In some embodiments, electronic devices can use named entity recognition algorithms to analyze key sentences, identify named entities in the key sentences, extract the named entities, and construct question-answer pairs. For example, the named entity recognition algorithm applicable to the embodiments of this application can be a named entity recognition method based on deep learning models with architectures such as bidirectional encoder representations from transformers (BERT), long short-term memory networks (LSTM), or neural network transformers / transformers.

[0113] For example, given the key sentence "The subsidy policy for new energy passenger vehicles will end on December 31, 2022," the electronic device can extract the named entity "time" from the key sentence as "December 31, 2022" to construct a question-and-answer pair. If the question in the pair is "When will the subsidy policy for new energy passenger vehicles end?", the answer would be "December 31, 2022." It can be understood that the essence of the electronic device constructing the question-and-answer pair is that the electronic device asks a question about the named entity in the key sentence and uses the specific numerical value of the named entity in the key sentence as the answer. In some embodiments, the specific numerical value of the named entity in the key sentence can also be referred to as the content of the named entity.

[0114] In some embodiments, a key sentence may include multiple named entities.

[0115] When multiple named entities are involved, and the named entities in a key sentence are different, electronic devices can use a named entity recognition algorithm to construct a question-answer pair for each named entity. For example, the key sentence is "The subsidy policy of 100,000 yuan for new energy passenger vehicles will end on December 31, 2022". This key sentence contains two different named entities: the amount "100,000 yuan" and the time "December 31, 2022".

[0116] In this example, electronic devices can use named entity recognition algorithms to construct a question-answer pair for the amount and the time, respectively. For example, question-answer pair 1 includes the question "When will the subsidy policy of 100,000 yuan for new energy passenger vehicles end?" and the answer "December 31, 2022", and question-answer pair 2 includes the question "What amount of subsidy policy for new energy passenger vehicles will end on December 31, 2022?" and the answer "100,000 yuan".

[0117] When multiple named entities are present in a key sentence, the electronic device cannot extract only a single named entity. Instead, it first extracts all named entities from the key sentence and determines whether there are connecting characters between them. Connecting characters include commas, hyphens, hyphens, and the suffix "to". In this example, after extracting multiple identical named entities, when connecting characters exist between them, the key sentence reflects the numerical changes of the named entities. The electronic device can then extract multiple named entities and the connecting characters, using the numerical values ​​of the named entities and the connecting characters as the answer.

[0118] Exemplarily, the key sentence is "From 2013 to 2014, the patent application volume in the content sharing scenario reached the maximum". The electronic device extracts multiple named entities as the times "2013" and "2014", and there is a connecting character "to" between the named entities. The electronic device can extract the time "2013 to 2014" in the key sentence to obtain the question "At what time did the patent application volume in the content sharing scenario reach the maximum", and the answer to this question is "From 2013 to 2014".

[0119] Taking the question "At what time did the patent application volume in the content sharing scenario reach the maximum" and the answer "From 2013 to 2014" as an example, in some embodiments, the question-and-answer pair can be stored in the following form:

[0120] {"question": "At what time did the patent application volume in the content sharing scenario reach the maximum", "answer": "From 2013 to 2014"}.

[0121] S404, based on the question-and-answer pairs, construct a question-and-answer database and a vector database.

[0122] It can be understood that by analyzing the content of the local file one by one, the electronic device can obtain multiple question-and-answer pairs, and the multiple question-and-answer pairs can constitute a question-and-answer database. Among them, the question-and-answer database contains multiple question-and-answer pairs in text form. In the embodiments of the present application, the purpose for the electronic device to obtain the question-and-answer database is: to facilitate obtaining the vector database and to facilitate comparing the question-and-answer pairs after the local file is updated. The relevant descriptions in the following embodiments can be referred to.

[0123] In some embodiments, after obtaining the question-and-answer database, the electronic device can perform vectorization processing on each question in the question-and-answer database to obtain a vector database. Among them, the vector database can be understood as containing multiple questions in vector form. In the embodiments of the present application, the purpose for the electronic device to obtain the vector database is: to facilitate calculating the similarity of questions so as to recommend to users. The relevant descriptions in the following embodiments can be referred to.

[0124] In some embodiments, after obtaining multiple question-and-answer pairs, the electronic device can number the question-and-answer pairs so that the question-and-answer pairs in the question-and-answer database and the questions in the vector database can correspond. Exemplarily, taking the question-and-answer pairs including question-and-answer pair 1, question-and-answer pair 2, and question-and-answer pair 3 as an example, the question in question-and-answer pair 1 is numbered as question 1, and the answer is numbered as answer 1. Similarly, the question in question-and-answer pair 2 is numbered as question 2, and the answer is numbered as answer 2. The question in question-and-answer pair 3 is numbered as question 3, and the answer is numbered as answer 3.

[0125] The question-and-answer database includes question 1 and answer 1, question 2 and answer 2, and question 3 and question 3. Accordingly, the electronic device can vectorize question 1 to obtain vectorized question 1; similarly, it can vectorize question 2 to obtain vectorized question 2, and question 3 to obtain vectorized question 3. The vector database includes vectorized question 1, vectorized question 2, and vectorized question 3. Specifically, vectorized question 1 corresponds to question 1, vectorized question 2 corresponds to question 2, and vectorized question 3 corresponds to question 3.

[0126] In summary, electronic devices can access a file attribute database, a question-and-answer database, and a vector database. The following embodiments illustrate this using an electronic device storing these databases as an example. The file attribute database is used by the electronic device to query file attributes, the vector database is used to query file content, and the question-and-answer database is used to compare question-and-answer pairs during local file updates. The process by which the electronic device uses the file attribute database, question-and-answer database, and vector database can be referred to the description in the following embodiments.

[0127] In some embodiments, the electronic device may store a file attribute library and a question-and-answer database. The file attribute library is used by the electronic device to query file attributes, and the question-and-answer database is used by the electronic device to query file content and to compare question-and-answer pairs when local files are updated.

[0128] In this embodiment of the application, the electronic device can analyze local files to obtain a file attribute library, a question-and-answer database, and a vector database, so that the electronic device can make recommendations to the user based on the file attributes (such as the file attribute library) and file content (vector database) of the local files during human-computer interaction.

[0129] After obtaining the file attribute library, question-and-answer database, and vector database, the electronic device can update the question-and-answer database and vector database when the local file is updated, taking into account that users may edit and modify the content of local files. After the content of local files is modified, the questions and / or answers in the question-and-answer pairs will also change. In order to avoid the electronic device recommending incorrect words or sentences to users, the electronic device can update the question-and-answer database and vector database when the local file is updated.

[0130] Referring to Figure 5, the method for updating the question-and-answer database and the vector database provided in this embodiment of the application may include:

[0131] S501, in response to local file updates, inputs the updated content and preset prompt into the LLM to obtain the key sentences of the updated content.

[0132] Users can modify the content of local files. Modifying the content of a local file can be understood as updating the content of the local file, i.e., updating the local file. In response to a local file update, the electronic device can determine the type of update to the local file.

[0133] The update types for local files can include: adding content, modifying content, and deleting content. Adding content refers to adding new content to an existing local file. Modifying content refers to modifying existing content. Deleting content refers to deleting existing content. Accordingly, when the update type is "add content," the updated content is the content added to the existing local file; when the update type is "modify content," the updated content is the content modified from the existing local file; and when the update type is "delete content," the updated content is the content deleted from the existing local file.

[0134] In some embodiments, the electronic device may execute S501 once it detects an update to a local file. In some embodiments, a user may modify the content of a local file multiple times within a preset time period. In this example, to reduce the power consumption of the electronic device, the electronic device may execute S501 in response to the last update of the local file within the preset time period.

[0135] In this embodiment of the application, the method by which the electronic device "inputs the updated content and the preset prompt into the LLM to obtain the key sentences of the updated content" can be referred to the description in S402. The difference between S402 and S402 is that S402 inputs "the content of the local file and the preset prompt into the LLM", while in this application, "the updated content and the preset prompt are input into the LLM".

[0136] Understandably, the default prompt in S501 is the first default prompt word.

[0137] S502 identifies named entities in the key sentences of the updated content and constructs question-answer pairs.

[0138] S502 can be referenced from the description in S403. The difference between S403 and S502 is that the key sentence in S403 is the key sentence of the local file content, while the key sentence in S502 is the key sentence of the updated content.

[0139] S503, determine if there exists a question in the question-answer database that has the same semantics as the question in the question-answer pair of the updated content. If yes, proceed to S504; otherwise, proceed to S505.

[0140] In some embodiments, the electronic device can input the questions in the question-and-answer pairs of the updated content, each question in the question-and-answer database, and a preset semantic prompt into the LLM. The LLM can output the result of "whether there is a question in the question-and-answer database that has the same semantics as the question in the question-and-answer pairs of the updated content". The preset semantic prompt can be referred to as the second preset prompt.

[0141] The preset semantic evaluation prompt instructs the LLM to determine whether a question exists in the question-and-answer database that has the same semantic meaning as the question in the question-and-answer pair of the updated content. For example, the preset semantic evaluation prompt might be: First sentence: {Sentence 1}, Second sentence: "{Sentence 2}". The prompt checks whether these two sentences might be the same sentence. These texts may be modified, abbreviated, or expanded, and their order may be scrambled, but they could still be the same sentence. If yes, return `True`, without returning any extra text; if no, return `False`. Here, Sentence 1 represents the question in the question-and-answer pair of the updated content, and Sentence 2 represents the question in the question-and-answer database. In this example, because semantic evaluation needs to be performed on each question in the question-and-answer database, there can be multiple Sentence 2s.

[0142] To reduce the power consumption of electronic devices, in some embodiments, the number of sentences requiring semantic discrimination by the electronic device can be reduced. In this example, the electronic device can perform similarity calculations between the questions in the question-and-answer pair of the updated content and each question in the question-and-answer database, and retrieve the question in the question-and-answer database that is most similar to the question in the question-and-answer pair of the updated content. For example, for ease of description, the question in the question-and-answer pair of the updated content is referred to as the first question, each question in the question-and-answer database is referred to as the second question, and the question in the question-and-answer database that is most similar to the question in the question-and-answer pair of the updated content is referred to as the third question:

[0143] In some embodiments, the electronic device may vectorize the first problem and each second problem, and then calculate the similarity between the vector of the first problem and the vector of each second problem. For example, the electronic device may calculate the cosine similarity between the vector of the first problem and the vector of each second problem.

[0144] Electronic devices can use either sparse vector-based or dense vector-based representations to vectorize the problem. Sparse vector-based representations include term frequency-inverse document frequency (TF-IDF) vectors, while dense vector-based representations include word-to-vector (Word2Vec), GloVe, BERT, and other models that embed vectors.

[0145] In some embodiments, the electronic device may vectorize a first question and then calculate the similarity between the vector of the first question and each vector in the vector database. It should be understood that since each vector in the vector database is obtained by vectorizing each question in the question-and-answer database, directly using the vector database in this example avoids vectorizing each question in the question-and-answer database again, reducing the computational load and power consumption of the electronic device.

[0146] After obtaining the similarity between the vector of the first problem and the vector of each second problem, the electronic device can take the second problem with the highest similarity as the third problem, which is the problem most similar to the first problem.

[0147] In this example, the electronic device can input a first question, a third question, and a preset semantic discrimination prompt into the LLM. The LLM can then output the result of "whether the semantics of the first question and the third question are the same." In this example, because the electronic device can pre-calculate the similarity between the first and second questions and filter out the second question that is most similar to the first question, i.e., the electronic device performs filtering before semantic discrimination, this reduces the number of second questions that the electronic device needs to semantically discriminate against for the first question, thus reducing the power consumption of the electronic device.

[0148] S504: When the update type is adding or modifying content, replace the question-and-answer pairs with the same semantic meaning in the question-and-answer database with the updated content question-and-answer pairs; when the update type is deleting content, delete the question-and-answer pairs with the updated content in the question-and-answer database.

[0149] If the questions in the question-and-answer pairs of the updated content have the same semantic meaning as the questions in the question-and-answer database, regardless of whether the update type is adding or modifying content, the questions in the question-and-answer pairs of the updated content already have semantically identical questions in the question-and-answer database, but the sentence structure may be different. Therefore, electronic devices can replace the question-and-answer pairs in the question-and-answer database with the question-and-answer pairs of the updated content. In other words, the question-and-answer database can replace the previous question-and-answer pairs with the same semantic meaning with the question-and-answer pairs of the updated content.

[0150] When the update type is "delete content," the updated content is the content deleted from the local file. If the questions in the question-answer pair of the updated content have the same semantics as the questions in the question-answer database, because the content in the local file has been deleted, the electronic device can correspondingly delete the question-answer pair of the updated content in the question-answer database to match the local file.

[0151] S505, when the update type is "add content", add the question-and-answer pairs of the updated content to the question-and-answer database; and when the update type is "modify content", replace the question-and-answer pairs with the same semantics in the question-and-answer database with the question-and-answer pairs of the updated content.

[0152] When the semantics of the questions in the question-answer pair being updated are different from those in the question-answer database, the following two scenarios exist:

[0153] 1) When the update type is new content, the questions in the question-answer pair of the updated content have different semantics from the questions in the question-answer database. This means that a new question-answer pair has been added to the content of the local file, and the electronic device can add the question-answer pair of the updated content to the question-answer database.

[0154] 2) When the update type is content modification, the questions in the question-and-answer pairs of the updated content are semantically different from the questions in the question-and-answer database. This is because the original content no longer exists after the content of the local file is modified. In this case, the electronic device can replace the question-and-answer pairs in the question-and-answer database with the question-and-answer pairs of the updated content.

[0155] In this embodiment, since the updated content is content deleted from a local file, and this deleted content already has a corresponding question-and-answer pair in the question-and-answer database, there must exist a question in the question-and-answer database with the same semantic meaning as the question in the question-and-answer pair of the updated content. Because this content has been deleted by the user, the question-and-answer pair in the question-and-answer database also needs to be deleted. Therefore, in this embodiment, S505 is not executed when the update type is content deletion.

[0156] Understandably, when an electronic device updates its question-and-answer database, it can also update its vector database accordingly. For example, when an electronic device replaces a question-and-answer pair in its database with an updated one, it can vectorize the question in the updated pair and replace the corresponding vector in the vector database with the one that has the same semantic meaning. For example, when an electronic device adds an updated pair to its database, it can vectorize the question in the updated pair and add the corresponding vector to the vector database. For example, when an electronic device deletes an updated pair from its database, it can delete the vector corresponding to the question in that pair from the vector database.

[0157] For example, here is a specific example illustrating the process of an electronic device updating its question-and-answer database and vector database:

[0158] For example, a user adds the text "The end date of the new energy passenger vehicle subsidy policy is December 31, 2023, xxxxxxxxxx" to a local file. The electronic device can input this text and a preset prompt into an LLM file to obtain the key sentence of the updated content: "The end date of the new energy passenger vehicle subsidy policy is December 31, 2023". The electronic device can then identify named entities in the key sentence of the updated content and construct question-answer pairs such as {"question":"The end date of the new energy passenger vehicle subsidy policy is","answer":"December 31, 2023"}.

[0159] The electronic device can calculate the similarity between the questions in the question-and-answer pair and the questions in the question-and-answer database. It can obtain the question with the highest similarity, such as "When will the subsidy policy for new energy passenger vehicles end?". The electronic device can input "The end time of the subsidy policy for new energy passenger vehicles is", "When will the subsidy policy for new energy passenger vehicles end?", along with a preset semantic discrimination prompt, into the LLM (Local Level Management System). The LLM can output that the two questions are semantically identical. The electronic device can replace the question-and-answer pair {"question":"When will the subsidy policy for new energy passenger vehicles end?", "answer":"December 31, 2023"} in the question-and-answer database with the question-and-answer pair {"question":"When will the subsidy policy for new energy passenger vehicles end?", "answer":"December 31, 2023"}.

[0160] In this embodiment of the application, when a user updates the content of a local file, the electronic device can update the question-and-answer database and the vector database accordingly, so that the electronic device can use the latest question-and-answer database and the vector database, thus ensuring the accuracy of human-computer interaction.

[0161] Having introduced the process of electronic devices acquiring and updating file attribute databases, question-and-answer databases, and vector databases, and given that electronic devices can store these databases, the following section describes how electronic devices use these databases to interact with users during human-computer interaction.

[0162] The human-computer interaction method provided in this application will be described below with reference to specific embodiments. These embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0163] Figure 6 is a flowchart illustrating one embodiment of the human-computer interaction method provided in this application. Referring to Figure 6, the human-computer interaction method provided in this application may include:

[0164] S601 receives user input.

[0165] User input can be text, voice, or images. When the input is text, the user can use the electronic device's input method, input through input boxes on the device's interface, or input via a question-and-answer format. For example, if the electronic device supports human-computer interaction, the user can input a question. When the input is voice, the user can use the electronic device's input method or input via a voice-based question-and-answer format. When the input is an image, the user can input an image through input boxes on the electronic device's interface.

[0166] It should be understood that the embodiments of this application do not limit the user's input method or the content of the input.

[0167] In some embodiments, the human-computer interaction method provided in this application can be applied to scenarios with predictive input. For example, when a user inputs data using an input method, the electronic device can perform the following steps based on the user's input to obtain recommended results. In this scenario, the electronic device can display the recommended results within the input method for the user to choose from, thus reducing the user's input time.

[0168] For example, referring to Figure 7, in a chat scenario, the user inputs the text "Zhang X's paper has" using an input method. The user's input is "Zhang X's paper has". The page in Figure 7 is the chat page.

[0169] In some embodiments, the human-computer interaction method provided in this application can be applied to human-computer question-and-answer scenarios. For example, a user inputs a question (i.e., user input) through an input box, and the electronic device can perform the following steps based on the user's input to obtain a recommendation result, which is an answer to the user's input question. In this scenario, the electronic device can display the recommendation result in a result display box.

[0170] For example, referring to Figure 8a, the user enters the question "What are Zhang X's papers?" through input box 81, where the user's input is "What are Zhang X's papers?".

[0171] It is understood that the embodiments of this application can also be applied to voice question and answer scenarios. For example, referring to ab in FIG9, after the user wakes up the voice assistant of the mobile phone, he or she enters the voice "What are Zhang X's papers?" The mobile phone can display the text corresponding to the voice "What are Zhang X's papers?" in the question and answer interface 91.

[0172] S602, when the input contains named entities, perform file attribute matching on the input according to the file attribute library.

[0173] It should be understood that when the input is non-text (such as speech, images, etc.), electronic devices can convert non-text into text. For example, when the input is speech, the electronic device can use technologies such as speech-to-text to convert speech into text. When the input is an image, the electronic device can use technologies such as optical character recognition (OCR) to convert the image into text.

[0174] In some embodiments, the electronic device can detect whether named entities exist in the input (text). In some embodiments, the electronic device can preset the types of named entities, such as names of people, organizations, places, numbers, dates, currencies, addresses, etc., and the electronic device can detect whether named entities of the preset types exist in the input.

[0175] When the input contains named entities, the input revolves around those named entities. The electronic device can first perform file attribute matching on the input against a file attribute library to detect whether a file attribute matching the input exists in the library. Detecting whether a file attribute matching the input exists in the file attribute library can be understood as detecting whether a file attribute with the same topic as the input exists in the file attribute library.

[0176] S603, when a matching file attribute exists in the file attribute library, output a recommendation result, which is the content in the file attribute library that matches the named entity and the file attribute.

[0177] In this embodiment, the electronic device can parse the semantics of the input, determine the topic of the input, and then check whether there is a matching file attribute in the file attribute library based on the topic of the input. For example, referring to Figure 7, when the user's input is "Zhang X has papers," the electronic device parses the semantics of the input, determines the topic of the input as a paper, and can query the file attribute "paper title" that matches "paper" in the file attribute library. Similarly, for example, referring to Figure 8a, when the user's input is "What papers does Zhang X have?", the electronic device parses the semantics of the input, determines the topic of the input as a paper, and can query the file attribute "paper title" that matches "paper" in the file attribute library. Figure 9, referring to the descriptions in Figures 7 and 8, shows the electronic device parses the input and determines the file attribute "paper title" that matches "paper" in the file attribute library.

[0178] When an electronic device detects a matching file attribute in its file attribute library, it can output a recommendation result. Specifically, the electronic device retrieves the recommendation result from the file attribute library based on the input and the matching file attributes. This recommendation result is the content in the file attribute library that matches the named entity and the file attribute; or, in other words, it is the content of the file attribute of the named entity in the file attribute library. The content of the file attribute of the named entity can be understood as the specific value assigned to the file attribute of the named entity.

[0179] The electronic device may output the recommendation results in the following ways: displaying the recommendation results on the interface of the electronic device, or outputting the recommendation results by voice playback. This application embodiment does not limit this.

[0180] For example, based on the input "Zhang X has papers" and the file attribute "paper title", the electronic device determines that the recommended result is the title of Zhang X's paper. The electronic device can query the title of Zhang X's paper in the file attribute library and output the recommended results such as "Title 1" and "Title 2". Here, Title 1 and Title 2 are used to represent specific paper titles, and the figure uses Title 1 and Title 2 as examples.

[0181] Referring to Figure 7, the electronic device can display recommended results in the input method, including "Title 1", "Title 2", etc. Referring to Figure 8b, after the user inputs "What are Zhang X's papers?", they can click the send control 82, and the electronic device can display the input "What are Zhang X's papers?" in the question-and-answer box 83. Referring to Figure 8c, after receiving the recommended results, the electronic device can display recommended results such as "Zhang X's papers have Title 1 and Title 2" in the question-and-answer box 83. Referring to Figure 9c, after receiving the recommended results, the electronic device can output the voice message "Zhang X's papers have Title 1 and Title 2", and display the corresponding text "Zhang X's papers have Title 1 and Title 2" in the question-and-answer interface 91.

[0182] In some embodiments, the recommendation result obtained based on file attributes (or a file attribute library) may be referred to as the first recommendation result.

[0183] In some embodiments, when a matching file attribute exists in the file attribute library, it can be referred to as "the file attribute in the corresponding file attribute library". In some embodiments, the file attribute in the file attribute library that matches the input can be referred to as the first file attribute.

[0184] [Correction based on Rule 91, 13.03.2026] S604: When there is no matching file attribute in the file attribute library, the input file content is matched according to the vector database to obtain the question with the highest similarity.

[0185] [Corrected according to Rule 91, March 13, 2026] When an electronic device detects that no matching file attribute exists in the file attribute database, it indicates that the input topic is not contained in the file attribute database. The electronic device can then continue to perform file content matching on the input based on the vector database to obtain the question with the highest similarity. File content matching refers to: when the file attribute does not contain the input topic, the electronic device detects whether the content of the local file contains the input topic.

[0186] [Correction based on Rule 91, March 13, 2026] In this example, the electronic device can vectorize the input to obtain a vector corresponding to the input. The electronic device can obtain the similarity between the vector corresponding to the input and each vector in the vector database, and obtain the vector in the vector database with the highest similarity to the vector corresponding to the input. Because the vectors in the vector database are the vectors corresponding to the questions in the question-answering database, the vector in the vector database with the highest similarity to the vector corresponding to the input is the question with the highest similarity to the input. In some embodiments, the vector in the vector database with the highest similarity to the vector corresponding to the input can be called the first vector.

[0187] [Corrected according to Rule 91, March 13, 2026] For example, the user's input is "Zhang X's date of birth," which contains the named entity "Zhang X." However, no matching file attribute "date of birth" is found in the file attribute database. Therefore, the electronic device can use a vector database to perform file content matching on the input. It is understood that, for example, the local file contains multiple papers by Zhang X, and the content of these papers may include information related to Zhang X's date of birth, school, major, etc. Therefore, the vector database may include questions related to Zhang X's date of birth, such as "What time was Zhang X born?". For example, the electronic device can obtain the question with the highest similarity to the input as "What time was Zhang X born?"

[0188] In some embodiments, the recommendation results obtained based on file content (or vector database) can be referred to as the second recommendation results.

[0189] S605, output the recommendation result, which is the answer corresponding to the question with the highest similarity.

[0190] The recommended answer is the answer corresponding to the question with the highest similarity. For example, if the question with the highest similarity is "What is the date and time of Zhang X's birth?", the corresponding recommended answer could be "Year x Month x Day".

[0191] [Correction based on Rule 91, 13.03.2026] S606, when there are no named entities in the input, the file content of the input is matched according to the vector database to obtain the question with the highest similarity.

[0192] It should be understood that S602 and S606 are steps that can be performed selectively.

[0193] S607, output the recommendation result, which is the answer corresponding to the question with the highest similarity.

[0194] [Correction 13.03.2026 based on Rule 91] In this embodiment of the application, when the electronic device detects that there is no named entity in the input, it can perform file content matching on the input according to the vector database to obtain the question with the highest similarity, and then recommend the answer corresponding to the question with the highest similarity to the user, as described in S604-S605.

[0195] [Corrected according to Rule 91, March 2026] In this embodiment, in response to user input, when named entities exist in the input, the electronic device can use a file attribute library based on local files to perform file attribute matching on the input. If the file attribute library contains file attributes that match the input, content matching both the named entity and the file attribute is recommended to the user. If the file attribute library does not contain file attributes that match the input, or if named entities do not exist in the input, the electronic device can use a vector database based on local files to perform file content matching on the input, recommending the answer corresponding to the question with the highest similarity to the input. In this application, on the one hand, the electronic device can make recommendations to the user based on local files, which can expand the application scenarios and scope; on the other hand, the electronic device can make recommendations to the user based on the file attributes and file content of local files, which can improve the accuracy and completeness of the recommendations and improve the user experience.

[0196] In some embodiments, to reduce the power consumption of the electronic device, trigger words can be pre-configured. In response to the presence of a trigger word in the input, the electronic device can execute the human-computer interaction method provided in this application embodiment. Furthermore, user input often contains pronouns. If the electronic device analyzes only independent sentences, it may infer that named entities do not exist in the input, leading to incorrect recommendations and reduced accuracy. In this application embodiment, the electronic device can combine the context of the input for pronoun resolution, accurately identifying named entities in the input and thus improving recommendation accuracy.

[0197] Figure 10 is a flowchart illustrating another embodiment of the human-computer interaction method provided in this application. Referring to Figure 10, the human-computer interaction method provided in this application may include:

[0198] S1001 receives the user's first input.

[0199] S1001 can be referred to the description in S601. It should be understood that, because the electronic device in this embodiment can perform referential resolution on the input, the input before referential resolution can be called the first input, and the input after referential resolution can be called the second input.

[0200] For example, the first input is "Lu X just graduated with a PhD. This is the thesis she wrote".

[0201] S1002, perform trigger word matching on the first input.

[0202] The trigger word can be a preset verb. In some embodiments, a verb library can be preset in the electronic device, and the verb library includes common verbs such as "is", "be", "in", "have", "call", "increase", "grow", "promote", "expand", "improve", "enhance", "inflate", "exceed", "be higher than", "decrease", "reduce", "shrink", "cut", "weaken", "wither", "drop", "be lower than", "adjust", etc.

[0203] Among them, the electronic device performs trigger word matching on the first input, which can be understood as: the electronic device detects whether there is a trigger word in the first input. It can be understood that in practical applications, the user can input characters in sequence, and the electronic device can detect whether there is a trigger word in the characters input by the user in sequence, that is, detect whether the characters input by the user are included in the verb library. In the embodiment of the present application, in response to the first input, the electronic device can detect whether there is a trigger word in the first input. Exemplarily, for example, the first input is "Lu X just graduated with a doctorate. The paper she wrote", and there is no trigger word in the first input.

[0204] In the case where there is no trigger word in the first input, the electronic device can continue to detect the user's input to detect whether there is a trigger word in the user's input. In some embodiments, in the case where there is no trigger word in the first input such as "Lu X just graduated with a doctorate. The paper she wrote", the electronic device can cache the first input in a sliding window, as shown in a in FIG. 11.

[0205] Exemplarily, if the user inputs the text "have", then the first input becomes "Lu X just graduated with a doctorate. The paper she wrote has". The electronic device detects that there is a trigger word "have" in the first input. In some embodiments, the electronic device can cache the first input such as "Lu X just graduated with a doctorate. The paper she wrote has" in a sliding window, as shown in b in FIG. 11.

[0206] S1003, in the case where there is a trigger word in the first input, the electronic device performs anaphora resolution on the first input to obtain a second input.

[0207] The electronic device performs anaphora resolution on the first input, which can be understood as: the electronic device combines the context of the first input, converts the pronouns in the first input into named entities, and thus obtains a second input.

[0208] For example, the first input is "Lu X just graduated with a PhD. She has written the following papers." The electronic device can detect pronouns in the first input and convert them into named entities. These pronouns can include, but are not limited to, "he," "she," "it," "this," "that," and "this." The electronic device detects the pronoun "she" in the first input. Based on the context, it can determine that "she" refers to "Lu X." Therefore, the electronic device can convert the pronoun "she" into the named entity "Lu X," resulting in the second input, "Lu X just graduated with a PhD. Lu X has written the following papers."

[0209] In some embodiments, if a trigger word exists in the first input, the electronic device can combine the punctuation marks in the first input to perform referential resolution on the last sentence in the first input, and use the resolved last sentence as the second input. This reduces the processing load of the electronic device. It is understood that a period represents the end of a sentence. Alternatively, a punctuation mark can represent the end of a sentence, which can be predefined.

[0210] This example uses a period to represent the end of a sentence. For instance, the first input is "Lu X just graduated with a PhD. She has written several papers." The electronic device, combining the punctuation in the first input, determines that the first input consists of two sentences, with the last sentence being "She has written several papers." The electronic device can then perform substitution and resolution on this last sentence, "She has written several papers," to obtain the second input, "Lu X has written several papers." It should be understood that the following example uses "Lu X has written several papers" as an example for illustration.

[0211] In some embodiments, the reference resolution method used by the electronic device may be a reference resolution method based on a deep learning model such as BERT, LSTM or Transformer, and this application embodiment does not limit this.

[0212] S1004, when a named entity exists in the second input, perform file attribute matching on the second input according to the file attribute library.

[0213] S1005, when a matching file attribute exists in the file attribute library, output a recommendation result, which is the content in the file attribute library that matches the named entity and the file attribute.

[0214] For example, taking "Lu X wrote a paper" as the second input, the electronic device parses the semantics of the second input and determines that the topic of the second input is a paper. The electronic device can query the file attribute "paper title" that matches "paper" in the file attribute library. Based on the second input "Lu X wrote a paper" and the file attribute "paper title", the electronic device determines that the recommended result is the title of the paper written by Lu X. The electronic device can query the title of the paper written by Lu X in the file attribute library and output recommended results such as "title 3" and "title 4". Here, title 3 and title 4 are used to represent specific paper titles.

[0215] For example, referring to Figure 12a, taking a user inputting information in an input method as an example, when the user inputs "Lu X just graduated with a PhD. Her thesis," the electronic device can remain silent and continue detecting the user's input because no trigger word is detected in the input. Referring to Figure 12b, when the user continues to input "Yes," the electronic device detects the trigger word and executes S1003-S1005, displaying recommended results such as "Title 3," "Title 4," etc., in the input method.

[0216] [Correction 13.03.2026 based on rule 91] S1006, when there is no matching file attribute in the file attribute library, the file content of the second input is matched according to the vector database to obtain the question with the highest similarity.

[0217] S1007, Output the recommendation result, which is the answer corresponding to the question with the highest similarity.

[0218] [Correction 13.03.2026 according to rule 91] S1008, when there is no named entity in the second input, the file content of the input is matched according to the vector database to obtain the question with the highest similarity.

[0219] S1009, Output the recommendation result, which is the answer corresponding to the question with the highest similarity.

[0220] S1004-S1009 can be referred to the descriptions in S602-S607.

[0221] In some embodiments, the steps in FIG10 can be simplified as shown in FIG13. Referring to FIG13, the human-computer interaction method provided in this application embodiment may include:

[0222] Step 1: Receive the user's first input.

[0223] Step 2: Does the trigger word match? If not, proceed to Step 3; if yes, proceed to Step 4.

[0224] Step 3: Cache the first input in the sliding window.

[0225] Step 4 refers to the process of dissolving.

[0226] Step 5: Rewrite the first input based on the punctuation to obtain the second input.

[0227] Step 6: Check if a named entity exists in the second input. If it exists, proceed to step 7; otherwise, proceed to step 8.

[0228] Step 7: File attribute matching. If a file attribute is matched, proceed to step 9; otherwise, proceed to step 8.

[0229] Step 8: The file content is matched, and then step 9 is executed.

[0230] Step 9: Return the recommended results.

[0231] The implementation of the steps in Figure 13 can be referred to the description in Figure 10.

[0232] In this embodiment, trigger words can be pre-configured. In response to the presence of a trigger word in the input, the electronic device can execute the human-computer interaction method provided in this embodiment, reducing the processing load and power consumption of the electronic device. Furthermore, the electronic device can perform referential resolution based on the input context, accurately identifying named entities in the input and improving recommendation accuracy.

[0233] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0234] The human-computer interaction method of the present application embodiments has been described above. The apparatus for executing the above method provided in the present application embodiments is described below. Those skilled in the art will understand that the methods and apparatus can be combined and referenced with each other, and the related apparatus provided in the present application embodiments can execute the steps in the above human-computer interaction method.

[0235] This application provides an electronic device. Referring to FIG14, the electronic device may include a processor 1401 (e.g., CPU) and a memory 1402. The memory 1402 may include high-speed random-access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device. The memory 1402 may store various instructions for performing various processing functions and implementing the method steps of this application.

[0236] Optionally, the electronic device involved in this application may further include: a power supply 1403, a communication bus 1404, and a communication port 1405. The communication port 1405 is used to enable communication between the electronic device and other peripherals. In this embodiment, the memory 1402 is used to store computer-executable program code, which includes instructions. When the processor 1401 executes the instructions, the instructions cause the processor 1401 of the electronic device to perform the actions described in the above method embodiment. The implementation principle and technical effects are similar and will not be repeated here.

[0237] Optionally, the electronic device involved in this application may further include: a display screen 1406. The display screen 1406 is used to display the interface of the electronic device.

[0238] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.

[0239] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.

[0240] In one possible implementation, a computer-readable medium may include random access memory (RAM), read-only memory (ROM), compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage or other magnetic storage devices, or any other medium intended to carry or store required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, digital versatile discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.

[0241] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.

[0242] It should be noted that the modules or components described in the above embodiments can be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), etc. Furthermore, when a module is implemented through processing element scheduler code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processors capable of calling program code, such as a controller. Additionally, these modules can be integrated together to implement a system-on-a-chip (SOC).

[0243] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A 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 flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can 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 can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).

[0244] The term "multiple" in this document refers to two or more. The term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the preceding and following related objects; in formulas, " / " indicates a "division" relationship. Additionally, it should be understood that in the description of this application, words such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0245] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application.

[0246] It is understood that, in the embodiments of this application, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

Claims

1. A human-computer interaction method, characterized in that, Applied to electronic devices, the method includes: Receive user input; When the input contains a named entity, a first recommendation result is output based on the file attribute library. The input corresponds to the first file attribute in the file attribute library. The first recommendation result is the content of the first file attribute of the named entity in the file attribute library. The file attribute library is obtained based on the file attributes of local files. When no named entity exists in the input, a second recommendation result is output based on a vector database. The vector database is obtained based on the file content of the local file and is used to indicate questions related to the file content. The second recommendation result is the answer corresponding to the question with the highest similarity to the input.

2. The method according to claim 1, characterized in that, Before outputting the first recommendation result based on the file attribute library, the process also includes: Detect whether there is a file attribute in the file attribute library that matches the input; If so, query the content of the first file attribute of the named entity in the file attribute library, and use the content as the first recommendation result.

3. The method according to claim 2, characterized in that, The file attributes that match the input are specifically the file attributes that match the topic of the input.

4. The method according to claim 2 or 3, characterized in that, The method further includes: When no file attribute matching the input is found in the file attribute library, the second recommendation result is output based on the vector database.

5. The method according to any one of claims 1-4, characterized in that, The vector database includes vectors of questions related to the file content, and the question-answer database includes questions related to the file content, as well as the answers to the questions. Before outputting the second recommendation result based on the vector database, the process also includes: The input is vectorized to obtain the vector of the input; In the vector database, obtain the first vector that has the highest similarity to the input vector; In the question-and-answer database, the answer to the question corresponding to the first vector is obtained; The answer to the question corresponding to the first vector is used as the second recommendation result.

6. The method according to any one of claims 1-5, characterized in that, The input is the first input. After receiving the user's input, the method further includes: Detect whether the first input contains a trigger word; If so, perform substitution elimination on the first input to obtain the second input; When the input contains named entities, the first recommendation result is output based on the file attribute library, including: When a named entity exists in the second input, the first recommendation result is output according to the file attribute library; When no named entity exists in the input, a second recommendation result is output based on the vector database, including: When no named entity exists in the second input, the second recommendation result is output based on the vector database.

7. The method according to claim 6, characterized in that, The step of performing substitution elimination on the first input to obtain the second input includes: Based on the punctuation marks in the first input, the last sentence in the first input is subjected to substitution resolution, and the second input is the last sentence after substitution resolution.

8. The method according to claim 6 or 7, characterized in that, The process of performing substitution resolution on the first input includes: Based on the context of the first input, the pronouns in the first input are converted into named entities.

9. The method according to any one of claims 1-8, characterized in that, The method further includes: Based on the predefined file attributes of each file type and the type of the local file, obtain the file attributes of the local file; The file attribute library is constructed based on the file attributes of the local files.

10. The method according to any one of claims 1-9, characterized in that, The method further includes: The file content of the local file and the first preset prompt word are input into the large language model to obtain the key sentence of the local file. The first preset prompt word is used to instruct the large language model to output the key sentence containing named entities. Identify named entities in the key sentences and construct question-answer pairs; Construct a question-answer database based on the question-answer pairs; The vector database is constructed based on the questions in the question-answer pairs.

11. The method according to claim 10, characterized in that, The process of identifying named entities in the key sentences and constructing question-answer pairs includes: Questions are posed to the named entities in the key sentences to obtain the questions in the question-answer pair; The content of the named entity in the key sentence is used as the answer to the question in the question-answer pair.

12. The method according to claim 10, characterized in that, The process of identifying named entities in the key sentences and constructing question-answer pairs includes: When there are multiple named entities in the key sentence, and the named entities are different, a question is asked for each named entity to obtain multiple question-answer pairs.

13. The method according to claim 10, characterized in that, The process of identifying named entities in the key sentences and constructing question-answer pairs includes: When there are multiple named entities in the key sentence, and the named entities are the same, determine whether there is a connecting character between the named entities; If so, ask questions about the named entities in the key sentences to obtain the questions in the question-answer pair; The content of the multiple named entities in the key sentence and the connecting characters are used as the answers to the questions in the question-answer pair.

14. The method according to any one of claims 10-13, characterized in that, The method further includes: In response to an update to the content of the local file, the updated content and the first preset prompt are input into the large language model to obtain the key sentence of the updated content; Identify named entities in the key sentences of the updated content and construct question-answer pairs; Determine whether there exists a question in the question-and-answer data that has the same semantics as the question in the question-and-answer pair of the updated content; If so, when the update type is adding or modifying content, replace the question-and-answer pair with the same semantic meaning in the question-and-answer database with the question-and-answer pair of the updated content; and when the update type is deleting content, delete the question-and-answer pair of the updated content in the question-and-answer database. If not, when the update type is "adding new content", the question-and-answer pair of the updated content is added to the question-and-answer database; and when the update type is "modifying content", the question-and-answer pair of the updated content replaces the semantically identical question-and-answer pair in the question-and-answer database.

15. The method according to claim 14, characterized in that, The question in the question-and-answer pair of the updated content is the first question, and the question in the question-and-answer database is the second question. Before determining whether there is a question in the question-and-answer data that has the same semantics as the question in the question-and-answer pair of the updated content, the method further includes: Obtain the similarity between the first question and each of the second questions; The second question with the highest similarity will be used as the third question; The step of determining whether there exists a question in the question-answer data that has the same semantics as the question in the question-answer pair of the updated content includes: Determine whether the semantics of the first question and the third question are the same.

16. The method according to claim 15, characterized in that, The determination of whether the semantics of the first question and the third question are the same includes: The first question, the third question, and the second preset prompt word are input into the large language model. The second preset prompt word is used to instruct the large language model to output whether the semantics of the first question and the third question are the same.

17. An electronic device, characterized in that, The electronic device includes: one or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1-16.

18. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1-16.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1-16.

20. A computer program product, characterized in that, The computer program product includes computer program code that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1-16.

Citation Information

Patent Citations

  • Material recommendation method, system and equipment based on natural language and medium

    CN114265926A

  • Question and answer retrieval method and system fusing document knowledge and question and answer pair data

    CN117407505A

  • Intelligent document question and answer method and device and computer readable storage medium

    CN118656457A

  • Systems, methods, and computer program products for providing contextually-aware video recommendation

    US20150100987A1

  • Method for determining text similarity, method for obtaining semantic answer text, and question answering method

    WO2021104323A1