Target query method and device, electronic equipment and readable storage medium
By determining multiple text libraries in specific domain knowledge query and prioritizing query based on matching degree, the problem of insufficient accuracy of recall information in the prior art is solved, and a deeper and more accurate knowledge representation is achieved.
Patent Information
- Application Number
- CN202411612836.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-18
AI Technical Summary
The existing technology has limitations in dealing with specific domain knowledge, which cannot meet professional or personalized knowledge needs, and mainly focuses on improving recall rates and fails to fully consider the accuracy of recall information, resulting in the model's knowledge representation in specific domains that is not in-depth and precise.
By obtaining the query text, determine at least two text libraries, and match the query text with these text libraries, determine the query order based on the matching degree, and prioritize queries in text libraries with high matching degree to improve query accuracy.
By ensuring that the query text is queried in the relevant text library and prioritized query based on the matching degree, the query accuracy and depth are improved, and the users' in-depth and accurate knowledge needs in a specific field are met.
Smart Images

Figure CN119474342A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a target query method, device, electronic device and readable storage medium. Background Art
[0002] With the development of artificial intelligence technology, large language models have made remarkable achievements in the fields of language understanding, logical reasoning, and complex question and answer. However, large language models have limitations in processing knowledge in specific fields and cannot meet professional or personalized knowledge needs. To solve this problem, existing technologies enhance the domain knowledge understanding ability of large language models by combining information retrieval technology. That is, existing technologies retrieve relevant information from existing resources and use this information to enrich the context of prompts, thereby improving the output stability and accuracy of the model. However, these methods mainly focus on improving the recall rate, that is, increasing the possibility of finding relevant information, but fail to fully consider the accuracy of the recalled information, resulting in the model not being deep and accurate enough in the knowledge representation of specific fields. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a target query method, device, electronic device and readable storage medium to solve the problem that the prior art mainly focuses on improving the recall rate, that is, increasing the possibility of finding relevant information, but fails to fully consider the accuracy of the recalled information, resulting in the model's knowledge representation in a specific field is not deep and accurate enough.
[0004] In a first aspect of an embodiment of the present application, a target query method is provided, the method comprising:
[0005] Acquire a query text for query; determine at least two text libraries according to the query text, and match the query text with the at least two text libraries to obtain a target matching degree between the query text and each text library; determine a query order for each text library in the at least two text libraries according to the target matching degree between the query text and each text library; query each text library according to the query order and the query text to obtain a target query result corresponding to the query text.
[0006] According to a second aspect of an embodiment of the present application, a target query device is provided, the device comprising:
[0007] The acquisition module is configured to acquire a query text for query; the matching module is configured to determine at least two text libraries according to the query text, and match the query text with the at least two text libraries to obtain a target matching degree between the query text and each text library; the determination module is configured to determine a query order for each text library in the at least two text libraries according to the target matching degree between the query text and each text library; the query module is configured to query each text library according to the query order and the query text to obtain a target query result corresponding to the query text.
[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0009] According to a fourth aspect of an embodiment of the present application, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0010] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0011] According to the technical solution provided by the embodiment of the present application, a query text for query is obtained; at least two text libraries are determined according to the query text, and the query text is matched with the at least two text libraries to obtain the target matching degree between the query text and each text library; the query order of each text library in at least two text libraries is determined according to the target matching degree between the query text and each text library; each text library is queried according to the query order and the query text to obtain the target query result corresponding to the query text. At least two text libraries are determined by the query text, so that the query text can be queried in the relevant text libraries, and the query accuracy can be preliminarily ensured. Then, the query order is determined by using the target matching degree between the query text and each text library, and the query is preferentially performed in the text library with high matching degree according to the query order, so as to further improve the query accuracy and ensure the accuracy of the query result. It avoids the problem that the prior art mainly focuses on improving the recall rate, that is, increasing the possibility of finding relevant information, but fails to fully consider the accuracy of the recall information, resulting in the problem that the model is not deep and accurate enough in the knowledge representation of a specific field. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1is a schematic diagram of an application scenario of an embodiment of the present application;
[0014] Figure 2 It is a flowchart of a target query method provided by an embodiment of the present application;
[0015] Figure 3 is a structural schematic diagram of a target query device provided in an embodiment of the present application;
[0016] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0018] A target query method, device, electronic device, and readable storage medium according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0019] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.
[0020] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, target query applications, shopping applications, etc.
[0021] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present application.
[0022] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application are not limited to this.
[0023] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.
[0024] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.
[0025] Figure 2 FIG. 1 is a flow chart of a target query method provided in an embodiment of the present application. Figure 2 As shown, the method includes:
[0026] S201, obtaining a query text for query;
[0027] S202, determining at least two text libraries according to the query text, and matching the query text with the at least two text libraries to obtain a target matching degree between the query text and each text library;
[0028] S203, determining a query order for each text library in at least two text libraries according to a target matching degree between the query text and each text library;
[0029] S204, query each text library according to the query order and the query text to obtain a target query result corresponding to the query text.
[0030] Specifically, the target query method of this embodiment can be executed by a user terminal or a server, and the following is an example of the execution subject, taking the user terminal as an example. The query text used for querying is text information, which can be directly input manually by the user, or can receive voice input through intelligent interaction. After receiving the voice input, the user terminal can recognize the received voice information to convert the voice information into text information.
[0031] It can be understood that after obtaining the query text for query, at least two text libraries can be determined according to the query text, and each of the at least two text libraries pre-stores knowledge of a specific field or a query text corresponding to the question. For example, each of the at least two text libraries stores text information in a field related to the query text, that is, knowledge of a specific field where the query text is located, so as to ensure that the query text can be queried in the text library of the relevant field, thereby improving query efficiency and query accuracy. Further, the query text is matched with at least two text libraries to obtain a target matching degree between the query text and each text library, and the target matching degree is used to characterize the similarity between the query text and the text library. The calculation of the target matching degree can be based on a variety of algorithms, such as cosine similarity, Jaccard similarity, or a keyword-based matching algorithm. In this way, the correlation between the query text and the text library can be quantitatively evaluated to determine which text library the query text is preferentially queried in.
[0032] It is understandable that after obtaining the target matching degree, the query order of each text library in at least two text libraries can be determined according to the target matching degree between the query text and each text library. Specifically, the priority can be set according to the target matching degree, that is, the text library with a higher matching degree is queried earlier. This can improve the query efficiency and reduce unnecessary computing resource consumption. Further, after determining the query order, each text library is queried according to the query order and the query text to obtain the target query result corresponding to the query text, so as to give priority to querying the text library with a high matching degree, and further improve the query accuracy.
[0033] According to the technical solution provided by the embodiment of the present application, a query text for query is obtained; at least two text libraries are determined according to the query text, and the query text is matched with the at least two text libraries to obtain the target matching degree between the query text and each text library; the query order of each text library in at least two text libraries is determined according to the target matching degree between the query text and each text library; each text library is queried according to the query order and the query text to obtain the target query result corresponding to the query text. At least two text libraries are determined by the query text, so that the query text can be queried in the relevant text libraries, and the query accuracy can be preliminarily ensured. Then, the query order is determined by using the target matching degree between the query text and each text library, and the query is preferentially performed in the text library with high matching degree according to the query order, so as to further improve the query accuracy and ensure the accuracy of the query result. It avoids the problem that the prior art mainly focuses on improving the recall rate, that is, increasing the possibility of finding relevant information, but fails to fully consider the accuracy of the recall information, resulting in the problem that the model is not deep and accurate enough in the knowledge representation of a specific field.
[0034] In some embodiments, at least two text libraries include a first text library and a second text library, and the query order of the first text library is higher than that of the second text library; each text library is queried according to the query order and the query text to obtain a target query result corresponding to the query text, including: using the first text library to determine a first query result corresponding to the query text, wherein the stored text in the first text library is obtained by extracting the initial text based on a first extraction method; in response to the first query result not meeting the query requirement, using the second text library to determine a second query result corresponding to the query text, wherein the stored text in the second text library is obtained by extracting the initial text based on a second extraction method; and obtaining the target query result corresponding to the query text according to the second query result.
[0035] Specifically, if the query order of the first text library is determined to be higher than that of the second text library according to the target matching degree, the first query result corresponding to the query text is determined by using the first text library according to the query order. Specifically, a text matching algorithm can be used to compare the query text with the text content in the first text library to determine the first query result corresponding to the query text. For example, a cosine similarity algorithm can be used to calculate the similarity between the query text and each text in the first text library, and the text with the highest similarity is selected as the first query result. Secondly, a text matching model based on deep learning can also be used. In order to capture the complex relationship and semantic similarity between texts, so as to provide more accurate query results. For example, the BERT (Bidirectional Encoder Representations from Transformers) model determines the first query result. It can be understood that after determining the first query result, if the result fails to meet the query requirements, the second text library can be used for querying. If the result fails to meet the query requirements, the subsequent query steps will no longer be executed.
[0036] In some examples, the stored text in the second text library and the stored text in the first text library are obtained based on different extraction methods, that is, the first text library is obtained by extracting text from the initial text based on the first extraction method, and the second text library is obtained by extracting text from the initial text based on the second extraction method. It should be noted that since the query order of the first text library is higher than the query order of the second text library, the extraction accuracy of the initial text by the first extraction method should be higher than the extraction accuracy of the initial text by the second extraction method. If the query order of the second text library is higher than the query order of the first text library, the extraction accuracy of the initial text by the second extraction method should be higher than the extraction accuracy of the initial text by the first extraction method. In this way, it can be ensured that the query text can be queried first in the text library with the highest storage text accuracy, and it can be ensured that the first query result meets the high-precision requirements. The specific first extraction method and the second extraction method will be described in detail in subsequent embodiments, and will not be elaborated here.
[0037] In some examples, when querying the second text library, a text matching model based on deep learning can be used. For example, BERT and BLEU models can be used. These models can understand the contextual meaning of the text through pre-training and fine-tuning, thereby providing more accurate query results in specific fields, and finally obtaining the target query result corresponding to the query text based on the second query result, that is, the second query result can be integrated to obtain the target query result corresponding to the query text, or the second query result can be used as a query prompt, and the query prompt and query text can be further used to generate the final query result through a large language model.
[0038] According to the technical solution provided in the embodiment of the present application, a first query result corresponding to the query text is determined using a first text library, wherein the stored text in the first text library is obtained by extracting the initial text based on a first extraction method; in response to the first query result not meeting the query requirement, a second query result corresponding to the query text is determined using a second text library, wherein the stored text in the second text library is obtained by extracting the initial text based on a second extraction method; and a target query result corresponding to the query text is obtained according to the second query result. The accuracy and depth of the query can be effectively improved, thereby providing a more in-depth and accurate knowledge representation in a specific field. This hierarchical query method not only improves the recall rate, but more importantly, ensures the accuracy of the query results, and meets the query requirements of users in a specific field.
[0039] In some embodiments, at least two text libraries also include an initial text library; after obtaining a target query result corresponding to the query text according to the second query result, it also includes: in response to the target query result not meeting the query requirement, using the initial text library to determine a third query result corresponding to the query text, wherein the initial text library stores the initial text; and generating a query result of the query text according to the third query result.
[0040] Specifically, the stored text in the initial text library is an unstructured original text that has not been processed by the extraction method, so it can retain more information and details, but its query efficiency and accuracy may not be as good as the text library processed by the extraction method. After determining the target query result according to the second query result, if the query demand is still not met, the initial text library can be further used for query. It can be understood that when using the initial text library for query, more complex text analysis methods can be used, such as text mining and information extraction technology based on natural language processing (NLP) technology. Extract key information, concepts, entities and relationships from the original text, so as to generate richer and more detailed query results. For example, the topic model algorithm in the text mining technology, such as LDA (Latent Dirichlet Allocation), can be used to identify the topic distribution in the text library, and extract the text paragraphs related to it according to the topic requirements of the query text. In addition, information extraction technology can be used to identify and extract entities and relationships with specific meanings from the text, such as names, places, organizations, events, etc., and build a knowledge graph to support more complex query requirements.
[0041] In some examples, the query order of the initial text library can be set to the lowest, that is, the initial text library will be used for query only when the query results of the first text library and the second text library fail to meet the query requirements. This can ensure the efficiency of the query process and provide more comprehensive and in-depth query results when necessary. That is, the initial text library is used to determine the third query result corresponding to the query text, and finally the query result of the query text is generated according to the third query result. Specifically, the third query result can be integrated to obtain the query result corresponding to the query text, or the third query result can be used as a query prompt, and the query prompt and the query text are further used to generate the final query result through the large language model.
[0042] According to the technical solution provided by the embodiment of the present application, in response to the target query result not meeting the query requirement, the initial text library is used to determine the third query result corresponding to the query text, wherein the initial text library stores the initial text; and the query result of the query text is generated according to the third query result. Through the hierarchical query method, the query sequence of different text libraries is combined to improve the accuracy and depth of the query, and meet the query requirements of users in specific fields. The accuracy of the query results is guaranteed, and a more in-depth and accurate knowledge representation is provided to users.
[0043] In some embodiments, the steps of the first extraction method include: determining ontology structured information used to store text; extracting sub-domain patterns corresponding to the ontology structured information through a general ontology knowledge base; extracting text from the initial text based on the ontology structured pattern and sub-domain pattern of the stored text, and storing the extracted text in a first text library.
[0044] Specifically, ontology structured information refers to a structured representation method that formally describes and organizes knowledge in a specific field under the framework of ontology. Ontology is a clear, formalized conceptual specification that can be used to describe concepts in a certain field and their relationships. Determine the ontology structured information used to store the text. For example, if the initial text is Romance of the Three Kingdoms, the ontology structured information can be the attributes of the characters, such as name, character, identity, etc.
[0045] In some examples, for Liu Bei, Guan Yu, and Zhang Fei, the ontology structured information may include their names, characters (Xuan De, Yun Chang, Yi De), identities (founders of Shu Han, military generals), abilities (benevolence, loyalty, bravery), etc. Further, the sub-domain patterns corresponding to the ontology structured information are extracted through the general ontology knowledge base, which is a database containing various domain knowledge, such as WordNet knowledge base or ConceptNet knowledge base, which can provide structured information of different entities such as characters, places, and events. For Liu Bei, Guan Yu, and Zhang Fei, the sub-domain patterns may include the events they participated in (the Peach Garden Oath of Brotherhood, the Three Heroes Fighting Lu Bu, the Battle of Chibi, etc.), the relationship between them (brotherhood), their respective historical status and influence, etc. Text extraction is performed from the initial text according to the ontology structured pattern and the sub-domain pattern of the stored text, and the extracted text is stored in the first text library. Among them, the initial text is the original text containing the story of Liu Bei, Guan Yu, and Zhang Fei, such as "The Romance of the Three Kingdoms". Text extraction is to extract texts related to Liu Bei, Guan Yu and Zhang Fei from Romance of the Three Kingdoms based on the ontology structured model and sub-domain model.
[0046] As an example, for example:
[0047] (Person) Name: Liu Bei; Identity: Han Dynasty relative; Birthplace: Zhuo County; Abilities: Leadership, Martial Arts; Events: Peach Garden Oath, Three Heroes vs. Lu Bu
[0048] (Person) Name: Guan Yu; Identity: Military General; Native Place: Jieliang, Hedong; Ability: Martial Arts (Green Dragon Crescent Blade) Events: Peach Garden Oath of Brotherhood, Three Heroes vs. Lu Bu
[0049] (Person) Name: Zhang Fei; Status: Military General; Birthplace: Zhuo County; Ability: Martial Arts (Zhangba Snake Spear) Events: Peach Garden Oath, Three Heroes vs. Lu Bu
[0050] According to the technical solution provided in the embodiment of the present application, the ontology structured information for storing text is determined; the sub-domain pattern corresponding to the ontology structured information is extracted through the general ontology knowledge base; text is extracted from the initial text according to the ontology structured pattern and the sub-domain pattern of the stored text, and the extracted text is stored in the first text library, and the text is extracted from the initial text through the ontology structured pattern and the sub-domain pattern, so that the extracted information helps to realize the structured storage and efficient retrieval of the text. By determining the ontology structured information for storing text, the text content can be better organized and understood. The sub-domain pattern corresponding to the ontology structured information is extracted using the general ontology knowledge base, which can further refine the text classification and improve the accuracy of information extraction. The text is extracted from the initial text in combination with the ontology structured pattern and the sub-domain pattern, ensuring the pertinence and effectiveness of the extraction process, so as to provide high-precision information for the query during the query process, and improve the query accuracy while ensuring the query recall rate.
[0051] In some embodiments, the steps of the second extraction method include: extracting initial triple information corresponding to the initial text from the initial text through an open information extraction method; using a multi-round prompting method to process the initial triple information to obtain target triple information, and storing the target triple information in a second text library.
[0052] Specifically, the open information extraction method is a technology that can automatically identify and extract structured information from unstructured text. This method extracts triple information with specific meanings from the initial text through natural language processing techniques such as syntactic analysis, entity recognition and relation extraction. Triple information usually includes three parts: entity, attribute and value, for example: (Liu Bei, is, a relative of the Han Dynasty) (Liu Bei, is, a relative of the Han Dynasty) (Guan Yu, has, Green Dragon Crescent Blade) (Zhang Fei, has, Zhangba Snake Spear) (Zhang Jiao, leads, Yellow Turban Bandits) (Liu Bei, participated in, Yellow Turban Uprising) (Guan Yu, participated in, Yellow Turban Uprising) (Zhang Fei, participated in, Yellow Turban Uprising) and so on.
[0053] It can be understood that the multi-round prompting method is an interactive information processing method based on dialogue, which prompts the user or system to provide more detailed information through multiple rounds of dialogue, so as to obtain more accurate triple information. In this embodiment, the multi-round prompting method can be used to further refine and confirm the initial triple information to ensure the accuracy of the target triple information. For example, for the initial triple information "Liu Bei-identity-Han Dynasty relative", the multi-round prompting method can further inquire about Liu Bei's native place, ability and other information, so as to obtain more complete triple information: "Liu Bei-native place-Zhuo County", "Liu Bei-ability-leadership, martial arts", etc. These target triple information will be stored in the second text library for use in subsequent query processes.
[0054] According to the technical solution provided in the embodiment of the present application, the initial triple information corresponding to the initial text is extracted from the initial text by an open information extraction method; the initial triple information is processed by a multi-round prompting method to obtain the target triple information, and the target triple information is stored in the second text library. In this way, more abundant and detailed structured information can be effectively extracted from the initial text, providing more comprehensive and in-depth support for the query process. At the same time, a comprehensive analysis and structured processing of the initial text is achieved, thereby improving the accuracy and depth of the query and meeting the query needs of users in specific fields.
[0055] In some embodiments, the method further includes: sequentially using the first text library, the second text library, and the initial text library as target text libraries, performing text recognition on the target text library using a data-driven method to obtain a target text corresponding to the target text library; performing text merging on the target text to obtain a target merged text, and using the target merged text to update the stored text of the first text library and the stored text of the second text library.
[0056] Specifically, the data-driven method is a method for learning and analyzing based on a large amount of data, and the text data is identified and classified by a machine learning algorithm, thereby realizing efficient processing of the target text library. In the present embodiment, the data-driven method can be applied to the text recognition of the target text library to identify the key information and features contained in the target text library. For example, by classifying and clustering the text in the target text library, the text paragraphs related to a specific query can be identified, thereby obtaining the target text.
[0057] It can be understood that after obtaining the target texts of different layers, text merging can be performed to obtain the target merged text, that is, by comparing the target texts of different layers (the first text layer, the second text layer, and the initial text layer) to identify important concepts and relationships that are present in some layers but missing in other layers, the comprehensiveness of the texts of each layer can be ensured. In the text merging process, a variety of strategies can be adopted, such as merging based on semantic similarity, merging based on keywords, etc. For example, text paragraphs with similar themes or contents can be merged into a unified text to reduce redundant information and improve the readability of the text. In this way, the merged target merged text will contain more comprehensive and accurate information, which will help to effectively update the stored texts in the first text library and the second text library.
[0058] According to the technical solution provided by the embodiment of the present application, the first text library, the second text library and the initial text library are used as the target text library in turn, and the target text library is subjected to text recognition using the data-driven method to obtain the target text corresponding to the target text library; the target text is subjected to text merging to obtain the target merged text, and the stored text of the first text library and the stored text of the second text library are updated using the target merged text. The first text library, the second text library and the initial text library can be continuously optimized and updated to ensure the timeliness and accuracy of the stored text. At the same time, the generation and update of the target merged text also provides a richer and more comprehensive text resource for the subsequent query process, thereby further improving the efficiency and quality of the query.
[0059] In some embodiments, after querying each text library according to the query order and the query text to obtain the target query result corresponding to the query text, it also includes: displaying the target query result through a visual interface; receiving feedback information input by the user through the visual interface, updating the target query result according to the feedback information to obtain target update information; using the target update information, updating the stored text associated with the first text library and the stored text associated with the target update information in the second text library.
[0060] Specifically, the display method of the visualization interface may include but is not limited to tables, charts, graphs, and other forms, so that users can intuitively understand the query results. For example, the query results can be displayed in a table, where each row represents a query result and each column represents a different attribute, such as entity name, attribute, value, etc. In addition, the distribution of the query results can also be displayed in a chart form, such as a bar chart, pie chart, etc., to help users quickly grasp the overall trend of the query results.
[0061] In the process of receiving user feedback information, the visual interface can provide a variety of interactive methods, such as clicking, dragging, filling in the input box, and voice input, so that users can easily express their needs and opinions. For example, a user can click on a query result item to mark it as interested or not interested, or fill in specific feedback information in the input box, such as an evaluation or suggestion on the query result.
[0062] It is understandable that when updating the target query results based on user feedback information, a variety of strategies can be adopted, such as adjusting query algorithm parameters based on user preferences, adjusting the ranking of query results based on user evaluations, etc. For example, if a user feedbacks that a query result is inaccurate or irrelevant, the system can reduce the weight of the result or remove it from the result list. On the contrary, if the user is satisfied with a query result, the system can increase the weight of the result or display it as a recommendation.
[0063] In this way, through the above-mentioned visual interface display and user feedback information processing, dynamic optimization and personalized adjustment of the target query results can be achieved, thereby improving the satisfaction and practicality of the query results. At the same time, the generation and application of target update information also provides strong support for the continuous optimization of the first text library and the second text library, ensuring the long-term effectiveness and adaptability of the query system.
[0064] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean 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 process of the embodiments of the present application.
[0065] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described in detail here.
[0066] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0067] Figure 3 Schematic diagram of a target query device provided by an embodiment of the present application. Figure 3 As shown, the device comprises:
[0068] The acquisition module 301 is configured to acquire a query text for query;
[0069] A matching module 302 is configured to determine at least two text libraries according to the query text, and match the query text with the at least two text libraries to obtain a target matching degree between the query text and each text library;
[0070] A determination module 303 is configured to determine a query order for each text library in at least two text libraries according to a target matching degree between the query text and each text library;
[0071] The query module 304 is configured to query each text library according to the query order and the query text to obtain a target query result corresponding to the query text.
[0072] In some embodiments, at least two text libraries include a first text library and a second text library, the query order of the first text library is higher than that of the second text library, and the query module 304 is also configured to use the first text library to determine a first query result corresponding to the query text, wherein the stored text in the first text library is obtained by extracting the initial text based on the first extraction method; in response to the first query result not meeting the query requirement, use the second text library to determine a second query result corresponding to the query text, wherein the stored text in the second text library is obtained by extracting the initial text based on the second extraction method; and obtain a target query result corresponding to the query text according to the second query result.
[0073] In some embodiments, at least two text libraries also include an initial text library, and the query module 304 is further configured to determine, in response to the target query result not meeting the query requirement, a third query result corresponding to the query text using the initial text library, wherein the initial text library stores the initial text; and generate a query result of the query text based on the third query result.
[0074] In some embodiments, the query module 304 is further configured to determine ontology structured information used to store text; extract sub-domain patterns corresponding to the ontology structured information through a general ontology knowledge base; extract text from the initial text according to the ontology structured pattern and sub-domain pattern of the stored text, and store the extracted text in a first text library.
[0075] In some embodiments, the query module 304 is also configured to extract initial triple information corresponding to the initial text from the initial text through an open information extraction method; use a multi-round prompting method to process the initial triple information to obtain target triple information, and store the target triple information in a second text library.
[0076] In some embodiments, the query module 304 is further configured to sequentially use the first text library, the second text library, and the initial text library as target text libraries, perform text recognition on the target text library using a data-driven method, and obtain a target text corresponding to the target text library; perform text merging on the target text to obtain a target merged text, and use the target merged text to update the stored text of the first text library and the stored text of the second text library.
[0077] In some embodiments, the query module 304 is also configured to display the target query results through a visual interface; receive feedback information input by the user through the visual interface, update the target query results according to the feedback information, and obtain target update information; and use the target update information to update the stored text associated with the target update information in the first text library and the stored text associated with the target update information in the second text library.
[0078] According to the target query device provided by the embodiment of the present application, a query text for query is obtained; at least two text libraries are determined according to the query text, and the query text is matched with the at least two text libraries to obtain the target matching degree between the query text and each text library; the query order of each text library in at least two text libraries is determined according to the target matching degree between the query text and each text library; each text library is queried according to the query order and the query text to obtain the target query result corresponding to the query text. At least two text libraries are determined by the query text, so that the query text can be queried in the relevant text libraries, and the query accuracy can be preliminarily ensured. Then, the query order is determined by using the target matching degree between the query text and each text library, and the query is preferentially performed in the text library with high matching degree according to the query order, so as to further improve the query accuracy and ensure the accuracy of the query result. It avoids the problem that the prior art mainly focuses on improving the recall rate, that is, increasing the possibility of finding relevant information, but fails to fully consider the accuracy of the recall information, resulting in the problem that the model is not deep and accurate enough in the knowledge representation of a specific field.
[0079] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0080] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , and may include more or less components than those shown in the figure, or different components.
[0081] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0082] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0083] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0084] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. The readable storage medium may include: any entity or device that can carry computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0085] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A target query method, characterized in that: include: Get the query text for querying; Determine at least two text libraries according to the query text, and match the query text with the at least two text libraries to obtain a target matching degree between the query text and each of the text libraries; determining a query order of each of the at least two text libraries according to a target matching degree between the query text and each of the text libraries; Each of the text libraries is queried according to the query sequence and the query text to obtain a target query result corresponding to the query text.
2. The method according to claim 1, characterized in that The at least two text libraries include a first text library and a second text library, and the query order of the first text library is higher than that of the second text library; and querying each of the text libraries according to the query order and the query text to obtain a target query result corresponding to the query text includes: Determining a first query result corresponding to the query text by using the first text library, wherein the stored text in the first text library is obtained by extracting the initial text based on a first extraction method; In response to the first query result not satisfying the query requirement, determining a second query result corresponding to the query text by using a second text library, wherein the stored text in the second text library is obtained by extracting the initial text based on a second extraction method; A target query result corresponding to the query text is obtained according to the second query result.
3. The method according to claim 2, characterized in that The at least two text libraries also include an initial text library; after obtaining the target query result corresponding to the query text according to the second query result, the method further includes: In response to the target query result not satisfying the query requirement, determining a third query result corresponding to the query text by using the initial text library, wherein the initial text library stores the initial text; A query result of the query text is generated according to the third query result.
4. The method according to claim 2, characterized in that: The steps of the first extraction method include: Determine the ontology structured information used to store the text; Extracting sub-domain patterns corresponding to the ontology structured information through a general ontology knowledge base; Text extraction is performed from the initial text according to the ontology structured model and the sub-domain model of the stored text, and the extracted text is stored in the first text library.
5. The method according to claim 2, characterized in that: The steps of the second extraction method include: Extracting initial triple information corresponding to the initial text from the initial text by an open information extraction method; The initial triple information is processed by using a multi-round prompting method to obtain target triple information, and the target triple information is stored in the second text library.
6. The method according to claim 3, characterized in that The method further comprises: The first text library, the second text library and the initial text library are used as target text libraries in sequence. Using a data-driven method to perform text recognition on the target text library to obtain a target text corresponding to the target text library; Text merging is performed on the target text to obtain a target merged text, and the stored text in the first text library and the stored text in the second text library are updated using the target merged text.
7. The method according to claim 1, characterized in that After querying each of the text libraries according to the query sequence and the query text to obtain the target query result corresponding to the query text, the method further includes: Displaying the target query results through a visual interface; Receiving feedback information input by the user through the visual interface, and updating the target query result according to the feedback information to obtain target update information; Using the target update information, the stored text in the first text library associated with the target update information and the stored text in the second text library associated with the target update information are updated.
8. A target query device, characterized in that: include: An acquisition module is configured to acquire a query text for query; a matching module configured to determine at least two text libraries according to the query text, and match the query text with the at least two text libraries to obtain a target matching degree between the query text and each of the text libraries; a determination module configured to determine a query order of each of the at least two text libraries according to a target matching degree between the query text and each of the text libraries; The query module is configured to query each of the text libraries according to the query sequence and the query text to obtain a target query result corresponding to the query text.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.