Water conservancy question answering method and device, computer equipment and storage medium

By using pre-trained database statement conversion models, semantic extraction models, and vectorization models to perform searches in water conservancy business databases, knowledge graph databases, and document vector libraries, the problem of low efficiency in traditional water conservancy data retrieval is solved, and efficient and accurate integration and response of multi-source heterogeneous data is achieved.

CN121524293APending Publication Date: 2026-02-13AEROSPACE CLOUD SPACE SPACE INFORMATION TECHNOLOGY (CHONGQING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511631025.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Traditional keyword-based water resources data retrieval methods cannot understand natural language, have low query efficiency, and struggle to simultaneously support efficient retrieval of multi-source heterogeneous water resources databases, knowledge graph databases, and document databases.

Method used

Using a pre-trained database statement conversion model, semantic extraction model, and vectorization model, the user-input question text is converted into a business database statement, which is then retrieved from a water conservancy business database, a knowledge graph database, and a document vector library. The response text is then generated through a generative model.

Benefits of technology

It enables efficient and accurate retrieval of multi-source heterogeneous water conservancy data, outputs accurate response text, improves query efficiency, and reduces data cleaning and transformation work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524293A_ABST
    Figure CN121524293A_ABST
Patent Text Reader

Abstract

The invention relates to a water conservancy question answering method and device, computer equipment and a storage medium. The water conservancy question answering method comprises the steps of obtaining a question text input by a user; converting the problem text into a business database statement, and performing retrieval in a water conservancy business database to obtain a business data retrieval result; extracting feature information of a water conservancy entity corresponding to the question text, and performing retrieval in a water conservancy knowledge map database to obtain a map retrieval result; performing vectorization processing on the problem text, and determining document data corresponding to the most similar document vector in the water conservancy document vector library as a document retrieval result; aggregating the retrieval results to obtain an aggregated text; and determining the most matched output cue word, and generating a reply text based on the aggregated text and the output cue word through a generation model. By adopting the method, a water conservancy business database, a water conservancy knowledge graph library and a water conservancy document library can be used as data sources, and multi-source heterogeneous knowledge is integrated and then output.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, in particular to a water conservancy problem reply method and device, computer equipment and a storage medium. BACKGROUND

[0002] Water conservancy is a general term for various engineering constructions built to control, utilize and protect surface and underground water resources and environment. Water conservancy data is huge, in order to quickly obtain search information, it is often searched in the form of a database, and the traditional keyword matching method is used.

[0003] However, the keyword matching search method cannot understand natural language, the input is limited to keywords, and the working principle is mainly to find words in the document, but it lacks semantic understanding of the document and is inefficient and inaccurate. SUMMARY

[0004] Therefore, it is necessary to provide a water conservancy problem reply method, device, computer equipment and storage medium capable of quickly and accurately searching in multiple water conservancy databases.

[0005] In a first aspect, the present application provides a water conservancy problem reply method, which comprises: obtaining a problem text input by a user; converting the problem text into a business database statement through a pre-trained database statement conversion model, searching in a water conservancy business database based on the business database statement to obtain a business data search result; extracting feature information of a water conservancy entity corresponding to the problem text through a semantic extraction model, searching in a water conservancy knowledge graph database based on the feature information to obtain a graph search result; vectorizing the problem text through a vectorization model to obtain a problem vector, determining the most similar document vector in a water conservancy document vector library, and taking the document material corresponding to the document vector as a document search result; aggregating the business data search result, the graph search result and the business vector search result to obtain an aggregated text, searching in a prompt word database based on the problem text to obtain the most matched output prompt word; inputting the aggregated text and the output prompt word into a generation model, and the generation model generates a reply text based on the aggregated text and the output prompt word.

[0006] Further, the business data in the business database is stored in the form of a table structure, and the table structure comprises a table name, a table name Chinese description, a field name and a field Chinese annotation; the problem text is converted into a business database statement through a pre-trained database statement conversion model, which comprises: combine the table structure and the prompt word sentence to obtain an assembled prompt word; the prompt word sentence is used for converting the text into a database statement; input the assembled prompt word and the question text into a pre-trained database statement conversion model, and enable the pre-trained database statement conversion model to convert the question text into a business database statement according to the assembled prompt word.

[0007] Further, the feature information of the water conservancy entity corresponding to the question text is extracted by the semantic extraction model, and the graph retrieval result is obtained by searching in the water conservancy knowledge graph database based on the feature information, including: extract the subject and predicate in the question text as feature information by the semantic extraction model, and match the subject and predicate with the entity name and relationship feature in the water conservancy knowledge graph database respectively; if there is a matching result, generate a graph retrieval sentence based on the target entity name and target relationship feature obtained by matching; search in the water conservancy knowledge graph database based on the graph retrieval sentence to obtain the entity basic attribute of the target entity and other associated entities associated with the target entity, and obtain the graph retrieval result by taking the entity basic attribute and the associated entity as the object.

[0008] Further, after the subject and predicate in the question text are extracted as feature information by the semantic extraction model, and the subject and predicate are matched with the entity name and relationship feature in the water conservancy knowledge graph database respectively, the method further includes: if there is no matching result, search in the water conservancy knowledge graph database by a multi-hop query method within three entity intervals of the subject and the target object in the question text; if the entity basic attribute of the target entity corresponding to the subject and other associated entities associated with the target entity can be searched, the result is taken as the graph retrieval result.

[0009] Further, the most similar document vector in the water conservancy document vector library is determined, and the document material corresponding to the document vector is taken as the document retrieval result, including: textually split the preset document material to obtain a split document; vectorize the split document by a vectorization model to form a document slice vector stored in the document vector library; calculate the cosine similarity of the question vector and the document slice vector, match the split document corresponding to the most similar multiple document slice vectors, and take the split document as the document retrieval result.

[0010] Further, the retrieving, based on the question text, in a prompt word database to obtain the most matched output prompt word comprises: generating a corresponding business category title according to a plurality of preset businesses, storing the preset businesses, the business category title and the mapping relationship in the prompt word database; determining a preset business with the greatest similarity to the question text, and taking a business category title corresponding to the preset business as the most matched output prompt word.

[0011] In a second aspect, the present application also provides a water conservancy question answering device, which comprises: an acquisition module configured to acquire a question text input by a user; a business library retrieval module configured to convert the question text into a business database statement through a pre-trained database statement conversion model, perform retrieval in a water conservancy business database based on the business database statement, and obtain a business data retrieval result; a graph library retrieval module configured to extract feature information of a water conservancy entity corresponding to the question text through a semantic extraction model, perform retrieval in a water conservancy knowledge graph database based on the feature information, and obtain a graph retrieval result; a vector library retrieval module configured to perform vectorization processing on the question text through a vectorization model to obtain a question vector, determine a most similar document vector in a water conservancy document vector library, and take a document material corresponding to the document vector as a document retrieval result; an output prompt word determination module configured to aggregate the business data retrieval result, the graph retrieval result and the business vector retrieval result to obtain an aggregated text, and retrieve in a prompt word database based on the question text to obtain the most matched output prompt word; an answering text generation module configured to input the aggregated text and the output prompt word into a generation model, and generate an answering text based on the aggregated text and the output prompt word.

[0012] In a third aspect, the present application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of any one of the above aspects when executing the computer program.

[0013] In a fourth aspect, the present application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the steps of the method of any one of the above aspects.

[0014] In a fifth aspect, the present application also provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the steps of the method of any one of the above aspects.

[0015] The aforementioned methods, apparatus, computer equipment, and storage media for answering water conservancy questions integrate multi-source heterogeneous knowledge by using water conservancy business databases, water conservancy knowledge graph databases, and water conservancy document databases as data sources. They efficiently and accurately output answers by understanding the natural language input by the user. Traditional keyword-based full-text retrieval systems require extensive data cleaning and transformation work, resulting in low query efficiency and difficulty in simultaneously retrieving data from databases, knowledge graph databases, and document databases. The method provided in this application can integrate multi-source heterogeneous knowledge using water conservancy business databases, water conservancy knowledge graph databases, and water conservancy document databases as data sources before outputting the results. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies 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.

[0017] Figure 1 This is a diagram illustrating the application environment of a water conservancy problem-solving method in one embodiment. Figure 2 This is a flowchart illustrating a method for answering water conservancy questions in one embodiment; Figure 3 This is a structural block diagram of a water conservancy knowledge graph in one embodiment; Figure 4 This is a retrieval process for a water conservancy business database in one embodiment; Figure 5 This is a retrieval process for a water conservancy knowledge graph database in one embodiment; Figure 6 This describes the retrieval process of a water conservancy document vector library in one embodiment; Figure 7 The process of adding prompt words in one embodiment; Figure 8 This is a structural block diagram of a water conservancy problem response device in one embodiment; Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0019] The water conservancy problem-solving method provided in this application can be applied to, for example...Figure 1 The application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data required by the server 104 to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. Among them, the terminal 102 can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices, Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0020] In an exemplary embodiment, as Figure 2 shown, a water conservancy problem answering method is provided, which is applied to Figure 1 the server 104 in the figure for example to illustrate, including the following steps 202 to step 212. Among them: Step 202, obtaining the question text input by the user.

[0021] Exemplarily, the question text is the query information input by the user about a certain water conservancy. Such as can be "the storage capacity of Miyun Reservoir in the past three months".

[0022] Step 204, converting the question text into a business database statement through a pre-trained database statement conversion model, retrieving the business data retrieval result in the water conservancy business database based on the business database statement.

[0023] Exemplarily, the water conservancy business database includes various types of data of each water conservancy, such as hydrological data, engineering design data, management data, monitoring data, historical records, etc. Optionally, the water conservancy data in the water conservancy business database is constructed in the form of table structure, and the fields of the table structure have Chinese and English, Chinese for understanding natural language, and English for generating database statements, such as sql statements.

[0024] Exemplarily, the database statement conversion model is trained by a plurality of corpora, the corpora are input into the language model, and the LoRA scheme is used for fine-tuning.

[0025] In the LoRA scheme, the smaller the lora_rank, the higher the parameter efficiency (fewer trainable parameters), but it may limit the expression ability of the model, and the present application selects a smaller value. At the same time, lora_alpha is set as a multiple of lora_rank (optionally, alpha = 2*r), to maintain stable training dynamics.

[0026] LoRA is a technique for efficient fine-tuning of models. It adapts to specific tasks by adding a small number of trainable parameters on top of the original model, rather than retraining the entire large model, thus greatly reducing the computational resources and storage requirements.

[0027] In step 206, the feature information of the water conservancy entity corresponding to the question text is extracted by the semantic extraction model, and the graph retrieval result is obtained by searching in the water conservancy knowledge graph database based on the feature information.

[0028] For example, the semantic extraction model identifies the question text through a similarity algorithm model.

[0029] For example, the semantic extraction model is pre-trained on the BERT (Bidirectional Encoder Representations from Transformers) model, which enables it to identify feature information in the question text. The feature information includes the basic capabilities of water conservancy entity names, relationships, and attributes.

[0030] For example, the water conservancy entity information can be a water conservancy engineering entity, such as a reservoir, administrative district, or dam. The information extracted from the question text is used as a query statement to search in the water conservancy graph database.

[0031] For example, the data in the knowledge graph database is organized in the form of a graph, where nodes represent entities or concepts, and edges represent the relationships or attributes between them. The core of the knowledge graph is to connect a large amount of scattered information in the form of a graph, so that machines can understand the complex relationships and provide support for intelligent applications.

[0032] For example, the knowledge graph database can be Apache Jena TDB. Apache Jena TDB is an open-source graph database that is a component of the Apache Jena framework, used to store and query RDF (Resource Description Framework) data. RDF is a standard format for representing knowledge graphs, suitable for handling complex and highly interconnected data.

[0033] In step 208, the question text is vectorized by the vectorization model to obtain the question vector, and the most similar document vector in the water conservancy document vector library is determined. The document material corresponding to the document vector is used as the document retrieval result.

[0034] For example, the vectorization model can be an Embedding model.

[0035] Exemplarily, the water conservancy document vector library is a library storing water conservancy document materials, wherein the water conservancy documents are also subjected to vectorization processing, so that the question vector can be subjected to similarity calculation with the document vectors in the vector library.

[0036] Exemplarily, the vector database can be ChromaDB, which can store complex and high-dimensional vector data and provide fast vector search capability, and support fast retrieval and similarity calculation of the vectors.

[0037] In step 210, the business data retrieval result, the graph retrieval result and the business vector retrieval result are aggregated to obtain an aggregated text; and the most matched output prompt word is obtained based on the question text in the prompt word database.

[0038] Exemplarily, the pre-trained generation model can be an artificial intelligence large model, which is constructed based on an artificial neural network, and can be a large language model.

[0039] The business data retrieval result, the graph retrieval result and the business vector retrieval result are input into the generation model, and the retrieval results are subjected to context fusion by the generation model to form the aggregated text. The business data retrieval result is marked with the context source from the water conservancy business database, the graph retrieval result is marked with the context source from the water conservancy knowledge graph database, and the business vector retrieval result is marked with the context source from the water conservancy document vector library.

[0040] Exemplarily, the output prompt word adds a title to the output text and classifies. The prompt word can be a summary description of the question text.

[0041] In step 212, the aggregated text and the output prompt word are input into the generation model, and the generation model generates a reply text based on the aggregated text and the output prompt word.

[0042] The aggregated text forms a complete context information, and provides the generation model with as comprehensive and rich information as possible, so as to provide a more accurate basis for the generated reply text. The output prompt word serves as a guide and direction for the generation model to generate a reply result, so that the generation model determines the theme, style and answer structure of the generated reply text.

[0043] In the above water conservancy problem reply method, the question text input by the user is first obtained; the business database statement is converted through a database statement conversion model to obtain a business data retrieval result by searching in a water conservancy business database; the feature information of the water conservancy entity corresponding to the question text is extracted through a semantic extraction model to obtain a graph retrieval result by searching in a water conservancy knowledge graph database; the question vector is obtained by vectorizing the question text through a vectorization model, and the most similar document vector in the water conservancy document vector library is determined, and the document material corresponding to the document vector is taken as the document retrieval result; the business data retrieval result, the graph retrieval result and the business vector retrieval result are aggregated to obtain an aggregated text as the context; the most matched output prompt word is obtained by searching in a prompt word database based on the question text; and the aggregated text and the output prompt word are input into a generation model, the aggregated text is taken as the context, and the output prompt word is taken as the prompt word, and the reply text is generated by the prompt word generation model based on the aggregated text and the output prompt word.

[0044] By taking the water conservancy business database, the water conservancy knowledge graph database and the water conservancy document database as data sources, multi-source heterogeneous knowledge is integrated, and answers are efficiently and accurately output based on understanding of the natural language input by the user. The traditional keyword-based full-text retrieval system needs a large amount of data cleaning and conversion and other pre-processing work, and the query efficiency is low, and it is difficult to support simultaneous retrieval of the database, the knowledge graph database and the document database. The method provided in the present application can integrate multi-source heterogeneous knowledge by taking the water conservancy business database, the water conservancy knowledge graph database and the water conservancy document database as data sources.

[0045] In some embodiments, the business data in the business database is stored in the form of a table structure, and the table structure includes a table name, a table name Chinese description, a field name and a field Chinese annotation; the question text is converted into a business database statement through a pre-trained database statement conversion model, including: combining the table structure and the prompt word statement to obtain an assembled prompt word; the prompt word statement is used to convert the text into a database statement; and the assembled prompt word and the question text are jointly input into the pre-trained database statement conversion model, so that the pre-trained database statement conversion model converts the question text into a business database statement according to the assembled prompt word.

[0046] Exemplarily, the business data in the business database is stored in a table structure format. The table name, the table name Chinese description, the field name and the field Chinese annotation have a mapping relationship.

[0047] Exemplarily, each table has a unique identifier, i.e., a table name. The table name adopts a concise and descriptive naming manner, and can intuitively reflect the business data content stored in the table. The table name in Chinese is used to enhance the readability and understandability of the data table. The field name is a unit for storing a specific type of data in the table, and each field has a unique name for identifying the data content stored in the field. The field Chinese annotation is used to explicitly indicate the purpose and meaning of the field, and the field Chinese annotation is an important part of the table structure design.

[0048] In some embodiments, the feature information of the water conservancy entity corresponding to the question text is extracted by a semantic extraction model, and the graph retrieval result is obtained by searching in the water conservancy knowledge graph database based on the feature information, including: extracting the subject and predicate in the question text as feature information by the semantic extraction model, and matching the subject and predicate with the entity name and relationship feature in the water conservancy knowledge graph database respectively; if there is a matching result, generating a graph retrieval sentence based on the target entity name and target relationship feature obtained by matching; searching in the water conservancy knowledge graph database based on the graph retrieval sentence to obtain the entity basic attribute of the target entity and other associated entities associated with the target entity, and taking the entity basic attribute and the associated entities as the object to obtain the graph retrieval result.

[0049] Exemplarily, the semantic body model can be a BERT model, and the BERT model is pre-trained to have the ability to identify water conservancy entities, relationship features and entity basic attributes in the text.

[0050] Exemplarily, the subject is an object representing a water conservancy entity in the question text, which is generally a noun. The predicate is the state relationship of the water conservancy entity in the question text.

[0051] Exemplarily, the question text is: Where is the location of Miyun Reservoir? The subject and predicate in the question text are extracted by the pre-trained semantic extraction model, the subject is Miyun Reservoir, and the predicate is the location relationship. The subject and predicate are matched with the entity and relationship name in the knowledge graph, and if they match, they are used as a regular expression to generate a sparql statement for querying the water conservancy knowledge graph database. The sparql statement is used to query the knowledge graph to obtain the object, i.e., other entities associated with the subject entity, including the entity basic attribute and other associated entities associated with the target entity.

[0052] Exemplarily, the water conservancy entity can be a reservoir, an administrative area, a gate dam, etc., the relationship feature can be an event, a scheme, a containing, a belonging, an association, an upstream, a downstream, etc., and the entity basic attribute can be the location of the reservoir, the completion year, the water level, etc.

[0053] In some embodiments, after extracting the subject and predicate in the question text as feature information by the semantic extraction model, and matching the subject and predicate with the entity names and relationship features in the water conservancy knowledge graph database respectively, the method further comprises: if there is no matching result, searching in the water conservancy knowledge graph database through a multi-hop query mode if the subject and the target object in the question text are within three entity intervals; if the entity basic attributes of the target entity corresponding to the subject and other associated entities associated with the target entity can be searched, the result is taken as the graph search result.

[0054] For example, if the result cannot be found, it is confirmed through multi-hop query whether the water conservancy entity can indirectly query the corresponding result.

[0055] For example, as shown in the query "How to dispatch the larger flood in Miyun Reservoir", "Miyun Reservoir" is a subject, "flood" is a subject, "dispatch plan" is a subject, and "larger flood" is a subject. Miyun Reservoir and larger flood are within 3 hops, and can be searched. Figure 3

[0056] For example, in the water conservancy knowledge graph, entities that can be water conservancy subjects can be used as the starting point of the knowledge graph.

[0057] For example, when constructing the knowledge graph, the knowledge graph is trained through question corpus, so that the relationship jump between multiple entities of a question or a sentence is within 3 or 4 hops.

[0058] In some embodiments, the most similar document vector in the water conservancy document vector library is determined, and the document material corresponding to the document vector is taken as the document search result, comprising: splitting the preset document material into text to obtain the split document; performing vectorization processing on the split document through a vectorization model to form a document slice vector stored in the document vector library; calculating the cosine similarity between the question vector and the document slice vector, matching the split document corresponding to the most similar multiple document slice vectors as the document search result.

[0059] For example, the vectorization model can be an Embedding model.

[0060] For example, a large amount of document materials are used to construct the water conservancy document vector library, and the document vector library needs to pre-split the documents in the system that need to be vectorized. For example, the text segments can be segmented according to the paragraphs, word count and punctuation of the document materials, and then the segmented text segments are vectorized through the Embedding model to form text slice vectors stored in the document vector library.

[0061] ​Exemplarily, after the user question text is vectorized by the Embedding model, cosine similarity calculation is performed on the text segment vectors stored in the document vector library, a plurality of text information segments most similar to the question are matched, that is, the split document.

[0062] In some embodiments, the retrieving, based on the question text in the prompt word database, of the most matched output prompt word includes: generating a corresponding business category title according to a plurality of preset businesses, and storing the preset businesses, the business category titles, and a mapping relationship in the prompt word database; and determining a preset business with the greatest similarity to the question text, and taking a business category title corresponding to the preset business as the most matched output prompt word.

[0063] Exemplarily, the businesses are classified, each classification has a title prompt word. The similarity of the natural language of the question text to the classification title prompt word is calculated to obtain the most relevant prompt word.

[0064] In a feasible implementation manner, the user question text includes a flood season frequency, and other related information is also displayed to the user according to a complete prompt word. In another feasible implementation manner, the user question is matched with the prompt word, and only the matched prompt word is queried.

[0065] As shown in Figures 4-7 , a flow framework diagram of a water conservancy question answering method in an embodiment is shown. Among them, Figure 4 is a retrieval process of a water conservancy business database, the large model can be a database statement conversion model, Figure 5 is a retrieval process of a water conservancy knowledge graph database, the BERT model is a semantic extraction model; Figure 6 is a retrieval process of a water conservancy document vector database, the Embedding model is a vectorization model, Figure 7 is a process of adding a prompt word.

[0066] Among them, Figures 4-7 is a continuous flowchart, Figure 4 the query result in Figure 5 is input to the generated large model context, Figure 6 the relevant text in is extracted and input to the generated large model context, and context aggregation is performed by the generated large model context module.

[0067] It should be understood that although the steps in the flowcharts involved in the embodiments described above are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the embodiments described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with at least some of the other steps or steps or stages in other steps.

[0068] Based on the same inventive concept, the embodiments of the present application also provide a water conservancy problem answering device for implementing the above-mentioned water conservancy problem answering method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above-mentioned method, so the specific limitations in one or more water conservancy problem answering device embodiments provided below can refer to the limitations of the water conservancy problem answering method described above, which will not be repeated here.

[0069] In one exemplary embodiment, as shown in Figure 8 A water conservancy problem answering device 800 is provided, including an acquisition module 802, a business library retrieval module 804, a graph library retrieval module 806, a vector library retrieval module 808, a first aggregation module 810 and a second aggregation module 812.

[0070] The acquisition module 802 is configured to acquire a question text input by a user; The business library retrieval module 804 is configured to convert the question text into a business database statement through a pre-trained database statement conversion model, perform retrieval in a water conservancy business database based on the business database statement, and obtain a business data retrieval result; The graph library retrieval module 806 is configured to extract feature information of a water conservancy entity corresponding to the question text through a semantic extraction model, perform retrieval in a water conservancy knowledge graph database based on the feature information, and obtain a graph retrieval result; The vector library retrieval module 808 is configured to perform vectorization processing on the question text through a vectorization model to obtain a question vector, determine a most similar document vector in a water conservancy document vector library, and take a document material corresponding to the document vector as a document retrieval result; The output prompt word determination module 810 aggregates the business data retrieval result, the graph retrieval result and the business vector retrieval result to obtain an aggregated text, and performs retrieval in a prompt word database based on the question text to obtain a most matched output prompt word; The reply text generation module 812 inputs the aggregated text and the output prompt word into a generation model, and the generation model generates the reply text based on the aggregated text and the output prompt word.

[0071] The modules in the water conservancy problem reply device can be implemented wholly or partially by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in the computer device in software form, so as to be invoked and executed by the processor to perform operations corresponding to the modules.

[0072] In an exemplary embodiment, a computer device, which can be a server, is provided, and an internal structure diagram of the computer device can be as shown in Figure 9 The computer device includes a processor, a memory, an input / output interface (I / O), and a communication interface. The processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store water conservancy data. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with terminals outside through a network connection. The computer program is executed by the processor to implement a water conservancy problem reply method.

[0073] Those skilled in the art can understand that Figure 9 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0074] In an embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0075] In an embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.

[0076] In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of any of the above method embodiments.

[0077] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.

[0078] The technical features of the above embodiments can be combined in any manner. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present disclosure.

[0079] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A method for answering water conservancy questions, characterized in that, The method includes: Get the question text entered by the user; The problem text is converted into a business database statement using a pre-trained database statement conversion model. Based on the business database statement, a search is performed in the water conservancy business database to obtain business data retrieval results. The feature information of the water conservancy entity corresponding to the question text is extracted by a semantic extraction model, and the graph retrieval results are obtained by searching the water conservancy knowledge graph database based on the feature information. The question text is vectorized using a vectorization model to obtain a question vector. The most similar document vector in the water conservancy document vector database is then determined, and the document data corresponding to this document vector is used as the document retrieval result. The business data retrieval results, the graph retrieval results, and the business vector retrieval results are aggregated to obtain aggregated text; based on the question text, the prompt word database is searched to obtain the most matching output prompt word; The aggregated text and the output prompt words are input into the generation model, which generates a response text based on the aggregated text and the output prompt words.

2. The method according to claim 1, characterized in that, The business data in the business database is stored in the form of a table structure, which includes a table name, a Chinese description of the table name, field names, and Chinese comments for the fields. The process of converting the question text into business database statements using a pre-trained database statement conversion model includes: The table structure and the prompt word statement are combined to obtain the assembled prompt word; the prompt word statement is used to convert the text into a database statement; The assembly prompt and the question text are input together into a pre-trained database statement conversion model, so that the pre-trained database statement conversion model converts the question text into a business database statement according to the assembly prompt.

3. The method according to claim 1, characterized in that, The step involves extracting feature information of the water conservancy entity corresponding to the question text using a semantic extraction model, and then retrieving the feature information from a water conservancy knowledge graph database to obtain graph retrieval results, including: The subject and predicate in the question text are extracted as feature information using a semantic extraction model, and the subject and predicate are matched with entity names and relation features in the water conservancy knowledge graph database, respectively. If a matching result is found, a graph retrieval statement is generated based on the target entity name and target relationship features obtained from the matching. Based on the graph retrieval statement, a search is performed in the water resources knowledge graph database to obtain the basic entity attributes of the target entity and other related entities associated with the target entity. The graph retrieval results are obtained by using the basic entity attributes and the related entities as objects.

4. The method according to claim 3, characterized in that, After extracting the subject and predicate from the question text using a semantic extraction model as feature information, and matching the subject and predicate with entity names and relation features in the water resources knowledge graph database, the method further includes: If no matching results are found, the subject and target object in the question text will be searched in the water resources knowledge graph database through a multi-hop query method within the three entity intervals. If the basic entity attributes of the target entity corresponding to the subject and other related entities associated with the target entity can be retrieved, they are taken as the graph retrieval results.

5. The method according to claim 1, characterized in that, The process of determining the most similar document vector in the water resources document vector database, and using the document data corresponding to that document vector as the document retrieval result, includes: The preset document data is split into text to obtain the split document; The split documents are vectorized using a vectorization model to form document slice vectors, which are then stored in the document vector library. The cosine similarity between the question vector and the document slice vector is calculated to match the split documents corresponding to the most similar document slice vectors, and the split documents are used as the document retrieval results.

6. The method according to claim 1, characterized in that, The most matching output prompt words obtained by searching the prompt word database based on the question text include: Generate corresponding business category titles according to multiple preset business functions, and store the preset business functions, business category titles, and mapping relationships in the prompt word database; The most similar word to the question text among the preset services is determined, and the title of the service category corresponding to that preset service is used as the most matching output prompt word.

7. A device for answering water conservancy questions, characterized in that, The device includes: The acquisition module is used to acquire the question text input by the user; The business database retrieval module is used to convert the question text into business database statements through a pre-trained database statement conversion model, and to perform retrieval in the water conservancy business database based on the business database statements to obtain business data retrieval results. The graph database retrieval module is used to extract feature information of water conservancy entities corresponding to the question text through a semantic extraction model, and to retrieve graph retrieval results based on the feature information in the water conservancy knowledge graph database. The vector library retrieval module is used to vectorize the question text using a vectorization model to obtain a question vector, determine the most similar document vector in the water conservancy document vector library, and use the document data corresponding to the document vector as the document retrieval result. The output prompt word determination module aggregates the business data retrieval results, the graph retrieval results, and the business vector retrieval results to obtain aggregated text; and searches the prompt word database based on the question text to obtain the most matching output prompt word. The response text generation module inputs the aggregated text and the output prompt words into the generation model, and the generation model generates response text based on the aggregated text and the output prompt words.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.