Information query method and device, electronic equipment and storage medium

CN117349417BActive Publication Date: 2026-09-08GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311333579.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-13
Publication Date
2026-09-08
Estimated Expiration
2043-10-13

AI Technical Summary

Technical Problem

但是,相关技术中的答案反馈效率还有待提升

Benefits of technology

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code that can be invoked by a processor to execute the methods described above.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117349417B_ABST
    Figure CN117349417B_ABST
Patent Text Reader

Abstract

The application discloses an information query method and device, electronic equipment and a storage medium, and relates to the technical field of data processing. The method comprises the following steps: an electronic equipment receives input target question information; the electronic equipment queries target answer information corresponding to the target question information from a local knowledge base of the electronic equipment, the local knowledge base comprises a plurality of set question and answer pairs, each set question and answer pair comprises set question information and set answer information corresponding to the set question information; if the target answer information is queried, the target answer information is output; if the target answer information is not queried, an answer query request is sent to a server, and the answer query request is used for querying target answer information corresponding to the target question information. In this way, in the case that the local knowledge base contains target answer information corresponding to the target question information, the electronic equipment can quickly query and output the target answer information from the local knowledge base, thereby improving the feedback efficiency of information query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to an information retrieval method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the emergence of the Chat Generative Pre-trained Transformer (ChatGPT), artificial intelligence (AI) tools such as AI dialogue and AI query have gained widespread popularity and attention, and various language processing models have also been developed. The convenience, efficiency, versatility, and wide range of applications of AI have greatly benefited people in their use.

[0003] In this technology, users input question information into an electronic device, which then transmits the question information to the cloud via an AI interface. The cloud's language processing model generates the corresponding answer, which is then fed back to the electronic device. However, the efficiency of answer feedback in this technology needs improvement. Summary of the Invention

[0004] This application proposes an information retrieval method, apparatus, electronic device, and storage medium to improve the accuracy of information retrieval.

[0005] In a first aspect, embodiments of this application provide an information query method applied to an electronic device. The method includes: receiving input target question information; querying target answer information corresponding to the target question information from a local knowledge base of the electronic device, wherein the local knowledge base includes multiple predefined question-answer pairs, each predefined question-answer pair including predefined question information and predefined answer information corresponding to the predefined question information; if the target answer information is found, outputting the target answer information; if the target answer information is not found, sending an answer query request to a server, wherein the answer query request is used to request the query of the target answer information corresponding to the target question information.

[0006] Secondly, embodiments of this application provide an information query device, comprising: a question receiving module, a first query module, an information output module, and a second query module. The question receiving module is used to receive input target question information; the first query module is used to query target answer information corresponding to the target question information from a local knowledge base of the electronic device, wherein the local knowledge base includes multiple predefined question-answer pairs, each predefined question-answer pair including predefined question information and predefined answer information corresponding to the predefined question information; the information output module is used to output the target answer information if it is found; the second query module is used to send an answer query request to a server if the target answer information is not found, the answer query request being used to query the target answer information corresponding to the target question information.

[0007] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code that can be invoked by a processor to execute the methods described above.

[0009] In the solution provided in this application, the electronic device receives input target question information; it then queries the target answer information corresponding to the target question information from its local knowledge base. The local knowledge base includes multiple predefined question-answer pairs, each including predefined question information and corresponding predefined answer information. If the target answer information is found, it is output; otherwise, an answer query request is sent to the server to request the search for the target answer information corresponding to the target question information. Thus, if the local knowledge base contains the target answer information corresponding to the target question information, the electronic device can quickly retrieve and output it, improving the feedback efficiency of information retrieval. Furthermore, if the local knowledge base does not contain the target answer information corresponding to the target question information, the server is called for further querying, avoiding problems such as information query failure. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A flowchart illustrating an information query method provided in an embodiment of this application is shown.

[0012] Figure 2 A schematic diagram of an electronic device provided in an embodiment of this application is shown.

[0013] Figure 3 A flowchart illustrating an information query method provided in another embodiment of this application is shown.

[0014] Figure 4 It shows Figure 3 A flowchart illustrating a sub-step of step S220 in one embodiment.

[0015] Figure 5 A flowchart illustrating an information query method provided in another embodiment of this application is shown.

[0016] Figure 6 This is a block diagram of an information query device provided according to an embodiment of this application.

[0017] Figure 7 This is a block diagram of an electronic device used to perform an information query method according to an embodiment of this application.

[0018] Figure 8 This is a storage unit in this application embodiment for storing or carrying program code that implements the information query method according to this application embodiment. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.

[0020] It should be noted that some processes described in the specification, claims, and accompanying drawings of this application include multiple operations that appear in a specific order. These operations may not be performed in the order they appear herein, or they may be performed in parallel. Operation numbers such as S110, S120, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be performed sequentially or in parallel. Also, the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or server that includes a series of steps or sub-modules is not necessarily limited to those steps or sub-modules that are explicitly listed, but may include other steps or sub-modules that are not explicitly listed or that are inherent to such process, method, product, or device.

[0021] In existing technologies, during human-computer question-and-answer sessions, AI interfaces are called to retrieve corresponding answers for user-input questions. This approach has the following drawbacks: calling AI interfaces incurs charges based on the number of times or the number of words in the output answer, resulting in high costs; AI interfaces require network access and are susceptible to network interference; and the internal reasoning and generation of answer information by models on cloud servers makes complex questions time-consuming.

[0022] The inventors have proposed an information retrieval method, apparatus, electronic device, and storage medium. The information retrieval method provided in the embodiments of this application will be described in detail below.

[0023] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an information query method provided in one embodiment of this application, applied to an electronic device. The following will combine... Figure 1 The information query method provided in the embodiments of this application will be described in detail. This information query method may include the following steps:

[0024] Step S110: Receive the input target problem information.

[0025] In this embodiment, the electronic device can be as follows: Figure 2The smartphones, tablets, and desktop computers shown can also be laptops, smartwatches, e-book readers, or MP3 (Moving Picture Experts Group Audio Layer III) and MP4 (Moving Picture Experts Group Audio Layer IV) players.

[0026] Optionally, the user can input the target question information into the electronic device using text input, voice input, or image input, etc., and this embodiment does not impose any limitations on this. Based on this, the received target question information can also be in text, voice, or image form; and the target question information is not merely a text message in the form of a question as it is literally described, but can be any sentence, any word, a voice message, or an image.

[0027] Step S120: Query the target answer information corresponding to the target question information from the local knowledge base of the electronic device. The local knowledge base includes multiple set question-answer pairs, and each set question-answer pair includes set question information and set answer information corresponding to the set question information.

[0028] In this embodiment, the electronic device's local knowledge base can pre-store multiple pre-defined question-and-answer pairs. Each pre-defined question-and-answer pair includes pre-defined question information and corresponding pre-defined answer information, both of which are in text format. The local knowledge base can be understood as a portion of the electronic device's storage space allocated for storing these multiple pre-defined question-and-answer pairs.

[0029] Before querying the target answer information corresponding to the target question information, the received target question information is first standardized in file format, that is, all are converted into text format target question information, i.e., target question text information. Then, the target answer information corresponding to the text format target question information is queried from the local knowledge base. Specifically, it can be checked whether there is any setting question information in the local knowledge base that matches the target question text information. If it exists, the setting question information corresponding to the setting question information that matches the target question text information is obtained as the target answer information; if it does not exist, it is determined that no target answer information was found.

[0030] In some implementations, the aforementioned query to see if there is any matching question information in the local knowledge base that matches the target question text information can be specifically achieved by obtaining the similarity between the target question text information and each set question information, and determining whether the similarity is greater than a first preset threshold. If the similarity is greater than the first preset threshold, it is determined that there is matching question information in the local knowledge base that matches the target question text information; if the similarity is less than or equal to the first preset threshold, it is determined that there is no matching question information in the local knowledge base that matches the target question text information.

[0031] In this approach, if multiple sets of question information have a similarity greater than a first preset threshold, the question information with the highest similarity can be identified as the matching question information with the target question text. Thus, based on similarity, the question information closest to the target question information can be matched more accurately, resulting in a more precise query for the target answer.

[0032] Understandably, electronic devices can provide users with information query functions through pre-installed information query applications. In simpler terms, users install the required information query applications on their electronic devices and use these applications to perform the information queries required in this application. Optionally, there can be multiple information query applications or just one. If there are multiple information query applications on the electronic device, each application can correspond to a local knowledge base. Of course, multiple information query applications can also share a single local knowledge base; this embodiment does not impose any limitations on this.

[0033] Step S130: If the target answer information is found, output the target answer information.

[0034] In this embodiment, if the electronic device retrieves the target answer information from the local knowledge base, it can output the target answer information in a target output mode. The target output mode can be a screen display output, a voice output, an email output, or a text message output, etc., and this embodiment does not impose any limitations on this.

[0035] Alternatively, the default output mode of the electronic device can be used as the target output mode. For example, the screen display output mode of the electronic device.

[0036] Alternatively, the user-defined output method can be used as the target output method. For example, voice output.

[0037] Optionally, a matching output method can be selected as the target output method based on the information format of the target answer. For example, if the target answer is in text, video, or image format, the matching output method could be the screen display output of an electronic device. Or, if the target answer is in audio format, the matching output method could be audio output.

[0038] Step S140: If the target answer information is not found, an answer query request is sent to the server. The answer query request is used to request the target answer information corresponding to the target question information.

[0039] Understandably, electronic devices such as smartphones, tablets, desktop computers, and laptops have limited storage space, and therefore, the number of question-answer pairs in their local knowledge base is also limited. Therefore, if an electronic device cannot find the target answer in its local knowledge base, it can send an answer query request to an external server, carrying the target question information in the request. The server can then respond to the query request, retrieve the target answer information corresponding to the target question information, and send the retrieved answer information back to the electronic device. The electronic device can then receive and output the target answer information returned by the server.

[0040] Optionally, the server may pre-store multiple sets of question-and-answer pairs that are different from the multiple sets of question-and-answer pairs in the aforementioned local knowledge base. For ease of description, the multiple sets of question-and-answer pairs in the local knowledge base are referred to as multiple first sets of question-and-answer pairs, and the multiple sets of question-and-answer pairs in the server are referred to as multiple second sets of question-and-answer pairs. The number of second sets of question-and-answer pairs is significantly greater than the number of first sets of question-and-answer pairs. In other words, this application can store most of the sets of question-and-answer pairs in the server to ensure that the electronic device has sufficient available storage space, thereby avoiding problems such as lag caused by excessive storage space consumption. Simultaneously, the electronic device can also retrieve the corresponding target answer information from the server even if the target answer information is not found in the local knowledge base, thus ensuring the smooth progress of information retrieval.

[0041] In other implementations, considering that in practical applications, the target question information input by users is generally diverse, it is theoretically impossible to completely count all the answers corresponding to all user question information. Therefore, electronic devices can send answer query requests to a server via an AI interface. In this case, the aforementioned server can be a cloud server provided by a third-party vendor offering AI services, including but not limited to natural language processing, image recognition, speech recognition, machine translation, and intelligent recommendation. Thus, the electronic device can invoke these services and functions from the cloud server based on the AI ​​interface.

[0042] In this approach, the aforementioned server has a natural language model pre-trained with a large number of training sample sets. The server can use this natural language model to generate target answer information corresponding to the target question information. Then, the server feeds back the generated target answer information to the electronic device, which can output the target answer information in the target output mode. The target output mode can be referred to the aforementioned content and will not be repeated here.

[0043] Clearly, in this approach, the AI ​​interface is only invoked when the electronic device cannot find the target answer in the local knowledge base. The server's natural language model then generates the corresponding target answer, rather than calling the AI ​​interface for every input question. This significantly reduces the cost of calling the AI ​​interface, thus lowering the information retrieval cost for the electronic device.

[0044] The aforementioned server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. This embodiment does not impose any restrictions on this.

[0045] In this embodiment, if the local knowledge base contains the target answer information corresponding to the target question, the electronic device can quickly retrieve and output it from the local knowledge base, thus improving the feedback efficiency of information retrieval. Furthermore, if the local knowledge base does not contain the target answer information corresponding to the target question, the answer information is generated by inferring from the natural language model on the server through the AI ​​interface. This avoids problems such as information retrieval failure and effectively compensates for the high cost, unverifiable accuracy of question answers, and long response times for complex questions caused by calling the AI ​​interface for each information retrieval process. In other words, faster and more accurate information retrieval is achieved with lower query costs.

[0046] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of an information query method provided in this application, applied to an electronic device. The following will be combined with... Figure 3 The information query method provided in the embodiments of this application will be described in detail. This information query method may include the following steps:

[0047] Step S210: Obtain the set text information.

[0048] In some implementations, the predefined text information can be generated based on the target information of the input question-and-answer pair to be generated. The target information can be in the form of text, images, videos, or audio, with text formats including PDF and Word documents. In this approach, developers can pre-input target information that users are likely to query into the electronic device, allowing the device to generate predefined question-and-answer pairs based on this information. This enables the electronic device to quickly retrieve and provide the corresponding answer information during subsequent user information queries.

[0049] In this method, if the target information is not in text form, the electronic device can convert the target information into text form and use it as the aforementioned set text information; if the target information is in text form, the electronic device can directly use the target information as the aforementioned set text information.

[0050] In other implementations, historical question-and-answer records can be obtained and used as the set text information. Understandably, since some answer information in certain historical question-and-answer processes is fed back by the server, meaning the electronic device does not store this part of the question information and its corresponding answer information, the electronic device can store the historical record of each information query, thereby obtaining the historical question-and-answer record information corresponding to each information query. This historical question-and-answer record information corresponding to each information query is stored in text form, and thus the stored historical question-and-answer record information can be obtained and used as the set text information. In this way, the question-and-answer pairs in the local knowledge base can be further enriched.

[0051] In this method, the electronic device can also output a first prompt message at the end of each question-and-answer session, i.e., when the user closes the information query dialog window. This first prompt message prompts the user to score the historical answers output during this question-and-answer process. The electronic device then stores the historical scores corresponding to each historical question-and-answer session. Furthermore, it acquires historical question-and-answer records corresponding to historical question-and-answer sessions with historical scores exceeding a preset score threshold, using this as the aforementioned set text information. This ensures the accuracy of the acquired set text information, thereby improving the accuracy of subsequent question-and-answer pairs generated based on this set text information.

[0052] In this approach, the number of text entries in historical question-and-answer records can be checked at preset intervals. If the number of text entries exceeds a first threshold, this portion of historical question-and-answer records can be acquired and used as the set text information. Furthermore, to save storage space on electronic devices, this portion of historical question-and-answer records can be deleted after generating the set question-and-answer pair based on this portion of historical question-and-answer records.

[0053] In some other implementations, the set text information is generated based on the target information of the input question-answer pair to be generated, and at the same time, historical question-answer record information is also obtained as the set text information. That is, the electronic device can obtain the set text information based on the target information input by the user and the historical question-answer record information, thereby enriching the number of set question-answer pairs in the local knowledge base based on more set text information.

[0054] Step S220: Based on the text content in the set text information, generate a set question and answer pair corresponding to the set text information.

[0055] In some implementations, considering that the text length of the setting text information varies in practical applications, and some setting text information is quite long, directly generating a setting question-and-answer pair based on all the text content of the setting text information would result in the setting question-and-answer pair containing too much content, which is not conducive to information retrieval. Therefore, please refer to... Figure 4 Step S220 may specifically include the contents of steps S221 to S224:

[0056] Step S221: Obtain the text length of the set text information.

[0057] The text length can be represented by the number of characters. For example, if the text information contains 500 characters (such as text, English letters and punctuation marks), the text length of the text information is 500.

[0058] Step S222: If the text length is greater than the first length threshold, the set text information is divided according to the target division rule to obtain multiple sub-text information, and the text length of each sub-text information is less than or equal to the first length threshold.

[0059] The first length threshold can be a pre-set value based on experience, such as 500 or 300. If the length of the set text information exceeds the first length threshold, it can be divided into multiple sub-text information according to the target segmentation rule, where the length of each sub-text information is less than or equal to the first length threshold. The target segmentation rule can be to segment the set text information every first length threshold. If the segmentation position is not at the end of a sentence but in the middle, the segmentation can be performed at the end of the sentence preceding the current segmentation position. This avoids dividing a sentence into two parts, which could prevent the accurate extraction of the sentence's important content.

[0060] Step S223: Generate a set question-and-answer pair corresponding to each sub-text information based on the text content in each sub-text information.

[0061] Furthermore, after obtaining multiple sub-text information, a set question-and-answer pair corresponding to each sub-text information can be generated based on the text content in each sub-text information.

[0062] In some implementations, the FastText classification tool can be used to classify each sub-text message into a topic category, obtaining the topic category corresponding to each sub-text message. Then, the TextRank algorithm is used to summarize the content of each sub-text message, obtaining content summary information for each sub-text message. Based on this content summary information, corresponding question information is generated. This generated question information can then be used as the set question information in the set question-answer pair corresponding to each sub-text message, and the extracted content summary information is used as the set answer information in the set question-answer pair corresponding to each sub-text message, thus obtaining the set question-answer pair corresponding to each sub-text message. Here, the content summary information can be understood as a more concise text information summarizing the important information content of the sub-text message.

[0063] Step S224: If the text length of the set text information is less than or equal to the first length threshold, then generate a set question and answer pair corresponding to the set text information based on the text content in the set text information.

[0064] Similarly, the FastText classification tool is used to classify the given text information into topics, obtaining the topic categories corresponding to the given text information; then, the TextRank algorithm is used to summarize the given text information, obtaining the content summary information of the given text information, and generating corresponding question information based on the given text information. The generated question information can then be used as the question information in the question-and-answer pair corresponding to the given text information, and the extracted content summary information can be used as the answer information in the question-and-answer pair corresponding to the given text information, thus obtaining the question-and-answer pair corresponding to the given text information.

[0065] In other embodiments, before step S221, it can be detected whether the set text information contains multiple paragraph identifiers, thereby determining whether the set text information contains multiple paragraphs; if it contains only one paragraph identifier, then the contents of steps S221 to S224 are executed; if it contains multiple paragraph identifiers, then the contents of steps S221 to S224 can be executed for the text paragraph corresponding to each paragraph identifier. That is to say, in this method, the sub-text information can be divided more quickly by combining the paragraph identifiers and the text length of the text paragraph corresponding to each paragraph identifier.

[0066] Step S230: Add the set question-and-answer pair to the local knowledge base.

[0067] In this embodiment, the local knowledge base may contain multiple defined topic categories and multiple defined question-and-answer pairs under each defined topic category. Based on this, before adding the aforementioned generated defined question-and-answer pairs to the local knowledge base, it can first be determined whether there is a defined topic category in the local knowledge base that is the same as the topic category of the generated defined question-and-answer pairs. If not, the topic category of the generated defined question-and-answer pairs is added to the local knowledge base, and the generated defined question-and-answer pairs are added to the newly added topic category for storage.

[0068] Optionally, if such a pair exists, it can be further determined whether a first set-topic question-and-answer pair with the same question information exists within the same set-topic category as the generated set-topic question-and-answer pair. The first set-topic question-and-answer pair is any set-topic question-and-answer pair within the same set-topic category. If a first set-topic question-and-answer pair with the same question information exists, it can be further determined whether the answer information in the generated set-topic question-and-answer pair matches the set-topic answer information in the first set-topic question-and-answer pair. If they match, there is no need to add the generated set-topic question-and-answer pair to the local knowledge base. If they do not match, and the answer information in the generated set-topic question-and-answer pair contradicts the set-topic answer information in the first set-topic question-and-answer pair, the set-topic answer information in the first set-topic question-and-answer pair can be modified to match the answer information in the generated set-topic question-and-answer pair. If they do not match, and the answer information in the generated set-topic question-and-answer pair does not contradict the set-topic answer information in the first set-topic question-and-answer pair, the answer information in the generated set-topic question-and-answer pair can be added to the set-topic answer information in the first set-topic question-and-answer pair. Here, matching answer information can be understood as the content similarity between the two answer information being greater than a preset similarity threshold.

[0069] In some implementations, if the answer information in the aforementioned generated set question-and-answer pair matches the set answer information in the first set question-and-answer pair, in addition to not needing to add the generated set question-and-answer pair to the local knowledge base, the repetition frequency value corresponding to the first set question-and-answer pair can be increased by a preset value, for example, the repetition frequency value corresponding to the first set question-and-answer pair can be increased by 1.

[0070] Step S240: Receive the input target problem information.

[0071] Step S250: Query the target answer information corresponding to the target question information from the local knowledge base of the electronic device. The local knowledge base includes multiple set question-answer pairs, and each set question-answer pair includes set question information and set answer information corresponding to the set question information.

[0072] Since the local knowledge base in this embodiment contains multiple set topic categories, when querying the target answer information corresponding to the target question information, the FastText classification tool can be used to classify the target question information into topics to obtain the target topic category corresponding to the target question information. Furthermore, the set topic category that is the same as the target topic category is first determined from the multiple set topic categories, and then the target answer information corresponding to the target question information is queried from the multiple set question-answer pairs under the target topic category in the local knowledge base.

[0073] Step S260: If the target answer information is found, output the target answer information.

[0074] Step S270: If the target answer information is not found, an answer query request is sent to the server. The answer query request is used to request the target answer information corresponding to the target question information.

[0075] In this embodiment, the specific implementation of steps S240 to S270 can be found in the content of the foregoing embodiments, and will not be repeated here.

[0076] In this embodiment, the electronic device can construct and enrich the set question-and-answer pairs in the local knowledge base based on diverse information. This means it can generate set question-and-answer pairs not only based on historical question-and-answer records but also by standardizing the format of the user-input target information. This makes the set question-and-answer pairs in the local knowledge base richer and more comprehensive. Furthermore, by performing text length segmentation, topic classification, and summary extraction on the set text information to generate set question-and-answer pairs, the efficiency of information retrieval can be improved more effectively. This allows the electronic device to promptly provide the user with the target answer information corresponding to the target question, thereby enhancing the user's information retrieval experience. Moreover, this embodiment also achieves the effects of the aforementioned embodiments, namely, achieving faster and more accurate information retrieval with lower query costs.

[0077] Please refer to Figure 5 , Figure 5 This is a flowchart illustrating an information query method according to another embodiment of this application, applied to an electronic device. The following will be combined with... Figure 5 The information query method provided in the embodiments of this application will be described in detail. This information query method may include the following steps:

[0078] Step S310: Obtain the set text information.

[0079] Step S320: Based on the text content in the set text information, generate a set question and answer pair corresponding to the set text information.

[0080] Step S330: Add the specified question-and-answer pair to the local knowledge base.

[0081] Step S340: Receive the input target problem information.

[0082] Step S350: Obtain the target topic category corresponding to the target problem information.

[0083] In this embodiment, the specific implementation of steps S310 to S350 can be found in the content of the foregoing embodiments, and will not be repeated here.

[0084] Step S360: If there is no set topic category that matches the target topic category corresponding to the target question information, it is determined that the target answer information has not been found, and an answer query request is sent to the server.

[0085] In this embodiment, the local knowledge base includes multiple defined topic categories and multiple defined question-answer pairs under each defined topic category. Based on this, after obtaining the target topic category corresponding to the input target question information, it can be further determined whether there is a defined topic category among the multiple defined topic categories that matches the target topic category.

[0086] Optionally, if no set topic category matches the target topic category corresponding to the target question information, it is determined that no target answer information was found, and an answer query request is sent to the server. The specific implementation method for sending the answer query request to the server can be found in the foregoing embodiments, and will not be repeated here.

[0087] Step S370: If there is a first topic category that matches the target topic category corresponding to the target question information, then obtain multiple set question-answer pairs under the first topic category as multiple first question-answer pairs, where the first topic category is any one of the multiple set topic categories.

[0088] Step S380: If the set question information in the second question-answer pair matches the target question information, then obtain the set answer information in the second question-answer pair as the target answer information corresponding to the target question information. The second question-answer pair is any one of the multiple first question-answer pairs.

[0089] Optionally, if a first topic category matching the target topic exists, then multiple predefined question-answer pairs under the first topic category are further obtained as multiple first question-answer pairs, wherein the first topic category is any one of the multiple predefined topic categories. Further, it is determined whether any predefined question information in a second question-answer pair among the multiple first question-answer pairs matches the target question information, wherein the second question-answer pair is any one of the multiple first question-answer pairs; where matching between question information can be understood as the similarity threshold between the question content of the question information being greater than a first similarity threshold, i.e., the similarity between the two question information is high.

[0090] Based on this, if the information in the second question-answer pair matches the information in the target question, the information in the second question-answer pair is retrieved and used as the target answer for the target question. Thus, by first performing a general screening based on topic categories, and then further filtering based on the similarity between question information to find second question-answer pairs that match the target question, and using the information in the second question-answer pair as the target answer, the speed of answer retrieval is greatly improved.

[0091] In some implementations, if the number of second question-answer pairs is 1, the set answer information in the second question-answer pair can be directly obtained as the target answer information.

[0092] In other embodiments, there are multiple second question-answer pairs, and each second question-answer pair carries a corresponding historical query frequency value. Based on this, the set answer information in the third question-answer pair can be obtained as the target answer information corresponding to the target question information. The third question-answer pair is the second question-answer pair with the largest historical query frequency value among the multiple second question-answer pairs. In other words, the larger the historical query frequency value of the question-answer pair, the higher the historical frequency value of the set answer information in the question-answer pair being output, which indicates that the set answer information is also more accurate. Therefore, when there are multiple second question-answer pairs, more accurate set answer information can be filtered out based on the historical query frequency value as the target answer information.

[0093] In this method, after obtaining the set answer information in the third question-answer pair as the target answer information corresponding to the target question information, the historical query frequency value carried by the third question-answer pair is increased; wherein, it is possible. The historical query frequency value can also be regarded as the repetition frequency value mentioned in the foregoing embodiments, that is, when each set question-answer pair is queried once, the historical query frequency value can be increased by a preset value, for example, by 1.

[0094] In one possible implementation, if the number of third question-answer pairs is 1, the set answer information in the third question-answer pair can be directly obtained as the target answer information.

[0095] In another possible implementation, if there are multiple third question-and-answer pairs, the most recent output time of the set answer information in each third question-and-answer pair is obtained; from the multiple third question-and-answer pairs, the third question-and-answer pair whose most recent output time is closest to the current time is selected as the fourth question-and-answer pair; the set answer information in the fourth question-and-answer pair is then selected as the target answer information corresponding to the target question information. Clearly, the most recently output set answer information is often the latest answer information. Therefore, when multiple third question-and-answer pairs are found, the set answer information in the fourth question-and-answer pair whose most recently output time is closest to the current time can be selected as the target answer information. This ensures that the latest answer information is returned for each input target question information.

[0096] In this approach, multiple question-and-answer pairs within the same topic category in the local knowledge base can be stored and sorted in descending order of historical query frequency. Furthermore, multiple question-and-answer pairs with the same historical query frequency can be further sorted in ascending order of their most recent output time. This allows for faster retrieval of the target answer during information searches.

[0097] Step S390: If no set question information in the second question-answer pair matches the target question information, it is determined that the target answer information has not been found, and an answer query request is sent to the server.

[0098] In this embodiment, the specific implementation of step S390, which involves sending an answer query request to the server when it is determined that no target answer information has been found, can be found in the content of the foregoing embodiments, and will not be repeated here.

[0099] In this embodiment, a topic category identical to the target topic category is first determined from multiple defined topic categories. Then, the target answer information corresponding to the target question information is queried from multiple defined question-answer pairs under the target topic category in the local knowledge base, thereby improving the efficiency of information retrieval. Furthermore, when multiple possible answer information is found, the historical query frequency value and the historical time when the defined answer information was last output are combined to achieve a more accurate retrieval of the target answer information, ensuring the accuracy of the target answer fed back to the user, and thus improving the user experience of information retrieval.

[0100] Please refer to Figure 6The diagram illustrates a structural block diagram of an information query device 400 according to an embodiment of this application, which is applied to an electronic device. The device 400 may include: a question receiving module 410, a first query module 420, an information output module 430, and a second query module 440.

[0101] The problem receiving module 410 is used to receive the input target problem information.

[0102] The first query module 420 is used to query the target answer information corresponding to the target question information from the local knowledge base of the electronic device. The local knowledge base includes multiple set question-answer pairs, and each set question-answer pair includes set question information and set answer information corresponding to the set question information.

[0103] The information output module 430 is used to output the target answer information if the target answer information is found.

[0104] The second query module 440 is used to send an answer query request to the server if the target answer information is not found. The answer query request is used to query the target answer information corresponding to the target question information.

[0105] In some embodiments, the information query device 400 may further include: a setting text acquisition module, a question-and-answer pair generation module, and an adding module. Specifically, the setting text acquisition module may be used to acquire setting text information before querying the target answer information corresponding to the target question information from the local knowledge base of the electronic device. The question-and-answer pair generation module may be used to generate a setting question-and-answer pair corresponding to the setting text information based on the text content in the setting text information. The adding module may be used to add the setting question-and-answer pair to the local knowledge base.

[0106] In this method, the question-and-answer pair generation module can be specifically used to obtain the text length of the set text information; if the text length is greater than a first length threshold, the set text information is divided according to the target division rule to obtain multiple sub-text information, and the text length of each sub-text information is less than or equal to the first length threshold; based on the text content in each sub-text information, a set question-and-answer pair corresponding to each sub-text information is generated; if the text length of the set text information is less than or equal to the first length threshold, a set question-and-answer pair corresponding to the set text information is generated based on the text content in the set text information.

[0107] In this approach, the setting text acquisition module can be used to generate the setting text information based on the target information of the input question-answer pair to be generated; and / or to acquire historical question-answer record information as the setting text information.

[0108] In some implementations, the local knowledge base includes multiple defined topic categories and multiple defined question-and-answer pairs under each defined topic category. The first query module may include a topic acquisition unit and a first query unit. The topic acquisition unit can be used to acquire the target topic category corresponding to the target question information. The first query unit can be specifically used to: if no defined topic category matches the target topic category corresponding to the target question information, determine that the target answer information has not been found; if a first topic category matches the target topic category corresponding to the target question information, acquire multiple defined question-and-answer pairs under the first topic category as multiple first question-and-answer pairs, where the first topic category is any one of the multiple defined topic categories; if the defined question information in a second question-and-answer pair matches the target question information, acquire the defined answer information in the second question-and-answer pair as the target answer information corresponding to the target question information, where the second question-and-answer pair is any one of the multiple first question-and-answer pairs; if no defined question information in a second question-and-answer pair matches the target question information, determine that the target answer information has not been found.

[0109] In this method, there are multiple second question-answer pairs, and each second question-answer pair carries a corresponding historical query frequency value. The first query unit can be specifically used to obtain the set answer information in the third question-answer pair as the target answer information corresponding to the target question information. The third question-answer pair is the second question-answer pair with the largest historical query frequency value among the multiple second question-answer pairs.

[0110] In this manner, the information query device 400 may further include a frequency adjustment module. The frequency adjustment module can be used to increase the historical query frequency value carried by the third question-answer pair after obtaining the set answer information in the third question-answer pair as the target answer information corresponding to the target question information.

[0111] In this approach, there are multiple third question-and-answer pairs. The first query unit can be specifically used to: obtain the most recent historical time when the set answer information in each third question-and-answer pair was output; from the multiple third question-and-answer pairs, obtain the third question-and-answer pair whose most recent historical time is closest to the current time, and use it as the fourth question-and-answer pair; obtain the set answer information in the fourth question-and-answer pair, and use it as the target answer information corresponding to the target question information.

[0112] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0113] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0114] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0115] In summary, the electronic device receives the input target question information; it then queries its local knowledge base for the corresponding target answer information. The local knowledge base includes multiple predefined question-answer pairs, each containing a predefined question and its corresponding predefined answer. If the target answer is found, it is output; otherwise, a query request is sent to the server. This query request requests the search for the target answer corresponding to the target question. Thus, if the local knowledge base contains the target answer, the electronic device can quickly retrieve and output it, improving the efficiency of information retrieval. Furthermore, if the local knowledge base does not contain the target answer, the server is invoked for further searching, preventing information retrieval failures.

[0116] The following will combine Figure 7 This application describes an electronic device.

[0117] Reference Figure 7 , Figure 7 This diagram illustrates a structural block diagram of an electronic device 500 provided in an embodiment of this application. The method described above in this embodiment can be executed by this electronic device 500. The electronic device can be an electronic terminal with data processing capabilities, including but not limited to smartphones, tablets, laptops, desktop computers, smartwatches, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, and smart home devices.

[0118] The electronic device 500 in this application embodiment may include one or more of the following components: processor 501, memory 502, and one or more application programs, wherein the one or more application programs may be stored in memory 502 and configured to be executed by one or more processors 501, and the one or more programs are configured to perform the methods as described in the foregoing method embodiments.

[0119] Processor 501 may include one or more processing cores. Processor 501 connects to various parts within the electronic device 500 using various interfaces and lines, and performs various functions and processes data of the electronic device 500 by running or executing instructions, programs, code sets, or instruction sets stored in memory 502, and by calling data stored in memory 502. Optionally, processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 501 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the aforementioned modem can also be integrated into processor 501 and implemented as a separate communication chip.

[0120] The memory 502 may include random access memory (RAM) or read-only memory (ROM). The memory 502 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 502 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 500 during use (such as the various correspondences described above).

[0121] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0122] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.

[0123] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0124] Please refer to Figure 8 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 600 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0125] The computer-readable storage medium 600 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 600 has storage space for program code 610 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 610 may be compressed, for example, in a suitable form.

[0126] In some embodiments, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps in the above-described method embodiments.

[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. An information retrieval method, characterized in that, Applied to electronic devices, the method includes: Obtain set text information, wherein the set text information includes historical question and answer record information where the historical score is greater than a preset score threshold, the historical score is obtained by the user scoring the answer information output during the question and answer process at the end of the question and answer, wherein the historical score is used to characterize the accuracy of the answer information; Obtain the text length of the specified text information; If the text length is greater than the first length threshold, the set text information is divided according to the target division rule to obtain multiple sub-text information, and the text length of each sub-text information is less than or equal to the first length threshold. Obtain the content summary information of each of the sub-text information, and generate corresponding question information based on the content summary information. Determine the generated question information as the set question information in the set question-answer pair corresponding to the sub-text information, and determine the content summary information as the set answer information in the set question-answer pair corresponding to the sub-text information, so as to generate the set question-answer pair corresponding to each of the sub-text information. If the length of the set text information is less than or equal to the first length threshold, then a set question-and-answer pair corresponding to the set text information is generated based on the text content in the set text information; Add the specified question-and-answer pairs to the local knowledge base; Receive the input target problem information; From the local knowledge base of the electronic device, the target answer information corresponding to the target question information is queried. The local knowledge base includes multiple set question-answer pairs, and each set question-answer pair includes set question information and set answer information corresponding to the set question information. If the target answer information is found, then the target answer information is output. If the target answer information is not found, an answer query request is sent to the server. The answer query request is used to request the server to generate target answer information corresponding to the target question information through a pre-trained natural language model.

2. The method according to claim 1, characterized in that, The acquisition of the specified text information includes at least one of the following acquisition methods: Based on the target information of the input question-answer pair to be generated, the set text information is generated; Obtain historical question and answer records as the set text information.

3. The method according to claim 1 or 2, characterized in that, The local knowledge base includes multiple defined topic categories and multiple defined question-answer pairs under each defined topic category. The step of querying the target answer information corresponding to the target question information from the local knowledge base of the electronic device includes: Obtain the target topic category corresponding to the target problem information; If no set topic category matches the target topic category corresponding to the target question information, then it is determined that the target answer information was not found. If there exists a first topic category that matches the target topic category corresponding to the target question information, then multiple set question-answer pairs under the first topic category are obtained as multiple first question-answer pairs, and the first topic category is any set topic category among the multiple set topic categories; If the set question information in the second question-answer pair matches the target question information, then the set answer information in the second question-answer pair is obtained as the target answer information corresponding to the target question information. The second question-answer pair is any one of the plurality of first question-answer pairs. If no matching question information in the second question-answer pair is found with the target question information, then the target answer information is determined not to be found.

4. The method according to claim 3, characterized in that, The number of the second question-and-answer pairs is multiple, and each second question-and-answer pair carries a corresponding historical query frequency value; The step of obtaining the set answer information in the second question-answer pair, which serves as the target answer information corresponding to the target question information, includes: Obtain the set answer information in the third question-answer pair as the target answer information corresponding to the target question information. The third question-answer pair is the second question-answer pair with the largest historical query frequency value among multiple second question-answer pairs. After obtaining the set answer information in the third question-answer pair as the target answer information corresponding to the target question information, the method includes: Increase the historical query frequency value carried by the third question and answer pair.

5. The method according to claim 4, characterized in that, The number of the third question-and-answer pairs is multiple, and the step of obtaining the set answer information in the third question-and-answer pairs as the target answer information corresponding to the target question information includes: Obtain the most recent historical time when the set answer information in each of the third question-and-answer pairs was output; From the multiple third question-and-answer pairs, select the third question-and-answer pair whose most recently output historical time is closest to the current time, and use it as the fourth question-and-answer pair; Obtain the set answer information from the fourth question-answer pair, and use it as the target answer information corresponding to the target question information.

6. An information query device, characterized in that, Applied to electronic devices, the device includes: A text acquisition module is configured to acquire set text information, wherein the set text information includes historical question and answer record information in which the historical score is greater than a preset score threshold. The historical score is obtained by the user scoring the answer information output during the question and answer process at the end of the question and answer process. The historical score is used to characterize the accuracy of the answer information. The question-answer pair generation module is used to obtain the text length of the set text information; if the text length is greater than a first length threshold, the set text information is divided according to the target segmentation rule to obtain multiple sub-text information, and the text length of each sub-text information is less than or equal to the first length threshold; the content summary information of each sub-text information is obtained, and corresponding question information is generated based on the content summary information; the generated question information is determined as the set question information in the set question-answer pair corresponding to the sub-text information, and the content summary information is determined as the set answer information in the set question-answer pair corresponding to the sub-text information, so as to generate a set question-answer pair corresponding to each sub-text information; if the text length of the set text information is less than or equal to the first length threshold, the set question-answer pair corresponding to the set text information is generated according to the text content in the set text information. The add module is used to add the specified question-and-answer pairs to the local knowledge base; The problem receiving module is used to receive the input target problem information; The first query module is used to query the target answer information corresponding to the target question information from the local knowledge base of the electronic device. The local knowledge base includes multiple set question-answer pairs, and each set question-answer pair includes set question information and set answer information corresponding to the set question information. The information output module is used to output the target answer information if the target answer information is found. The second query module is used to send an answer query request to the server if the target answer information is not found. The answer query request is used to request the server to generate target answer information corresponding to the target question information through a pre-trained natural language model.

7. An electronic device, characterized in that, include: One or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that can be invoked by a processor to execute the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Searching method and system

    CN102385577A

  • Updating method, device and equipment of intelligent customer service knowledge base and storage medium

    CN112148743A

  • Knowledge base construction method, information query method, device and equipment

    CN116010571A