Knowledge question answering method and apparatus
Patent Information
- Application Number
- CN202610961737.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-10-13
AI Technical Summary
[0003]当前财务人员通过搜索引擎和内部知识库的知识检索模式结合大模型实现的财务知识检索,由于财务知识涉及领域广泛,需要涉及大模型的多表联动查询,由于数据来源的多样性,数据口径不统一,导致大模型无法准确理解用户查询意图,从而生成出错误的查询语句,使得返回的查询数据出现偏移,最终产生“AI幻觉”,降低了财务知识问答的准确性
[0022]为了解决在通过大模型对财务知识进行知识问答时容易产生AI幻觉的技术问题,本申请的实施例通过对接收到的查询文本与预设的文档库中的各个标签进行匹配,在匹配成功的情况下,获取相应的查询结果由大模型形成返回客户的回答信息,本申请的有益效果为:本申请的实施例通过标签匹配数据的方式实现数据查询,而非直接通过大模型直接查询多个表的数据,极大地限定了被查询的数据的范围,以及提高了查询的准确度,避免大模型对过多数据处理时的限制被查询数据过多导致的AI幻觉,使得问答结果更加精准,符合财务领域知识问答的特点。
Smart Images

Figure CN122903548A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically to a knowledge question-answering method, apparatus, device, medium, and program product. Background Technology
[0002] In today's digital age, concepts such as intelligent finance, automated financial office, and electronic invoicing are emerging one after another. The financial industry has increasingly higher requirements for knowledge updates and iterations, and enterprises face the challenge of managing and analyzing massive amounts of data. Finance personnel need to acquire cutting-edge financial knowledge in a timely and accurate manner to better perform their duties and empower corporate management decisions.
[0003] Currently, finance personnel rely on a combination of search engines and internal knowledge bases to retrieve financial knowledge using large-scale models. However, due to the wide range of areas covered by financial knowledge, this requires multi-table queries within the large-scale models. The diversity of data sources and inconsistent data definitions can lead to the large-scale models failing to accurately understand the user's query intent, resulting in incorrect query statements. This causes the returned query data to be skewed, ultimately creating an "AI illusion" and reducing the accuracy of financial knowledge Q&A. Summary of the Invention
[0004] In view of the above problems, this application provides knowledge question answering methods, devices, equipment, media and program products to improve the accuracy of question answering.
[0005] According to a first aspect of this application, a knowledge question answering method is provided, comprising: receiving query text from a user; performing a first query operation based on the query text to query a preset knowledge base; wherein the preset knowledge base includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried; if the first query operation is successful, obtaining a first query result; and forming answer information based on the first query result.
[0006] According to an embodiment of this application, after performing a first query operation based on the query text to query a preset knowledge base, the method further includes: if the first query operation fails, performing a second query operation to query a preset document library; wherein the second query operation includes generating a query statement through the query text to query the preset document library; if the second query operation succeeds, obtaining a second query result; and forming answer information based on the second query result.
[0007] According to an embodiment of this application, the first query operation includes: matching the query text with the tag using a preset pattern mapper; and, if the query text matches the tag, obtaining the corresponding data to be queried as the first query result.
[0008] According to an embodiment of this application, the second query operation includes: parsing the query text to obtain semantic information; forming a database query statement based on the semantic information to query the data to be queried in the preset document library; and, if the database query statement is successful, obtaining the corresponding data as the second query result.
[0009] According to an embodiment of this application, parsing the query text to obtain semantic information includes: extracting the semantic information of the query text based on preset keyword rules.
[0010] According to an embodiment of this application, parsing the query text to obtain semantic information further includes: extracting semantic information from the query text based on calling a large model interface.
[0011] According to an embodiment of this application, the step of forming a database query statement based on the semantic information to query the data to be queried in the preset document library includes: forming the database query statement based on the semantic information, wherein the database query statement includes a data definition language and financial indicators.
[0012] A second aspect of this application provides a knowledge question-answering device, the device comprising: a receiving module for receiving query text from a user; a first query module for performing a first query operation based on the query text to query a preset knowledge base; wherein the preset knowledge base includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried; a result acquisition module for acquiring a first query result if the first query operation is successful; and an answering module for generating answer information based on the first query result.
[0013] According to an embodiment of this application, the device further includes: a second query module, configured to perform a second query operation to query a preset document library when the first query operation fails; wherein the second query operation includes generating a query statement through the query text to query the preset document library; a result acquisition module, further configured to acquire a second query result when the second query operation succeeds; and an answer module, further configured to form answer information based on the second query result.
[0014] According to an embodiment of this application, the first query module is specifically used to match the query text with the tag through a preset pattern mapper; and when the query text matches the tag, to obtain the corresponding query data as the first query result.
[0015] According to an embodiment of this application, the second query module is specifically used to parse the query text to obtain semantic information; form a database query statement based on the semantic information to query the data to be queried in the preset document library; and, if the database query statement is successful, obtain the corresponding data as the second query result.
[0016] According to an embodiment of this application, the second query module is specifically used to extract semantic information of the query text based on preset keyword rules.
[0017] According to an embodiment of this application, the second query module is specifically used to extract semantic information from the query text based on calling the large model interface.
[0018] According to an embodiment of this application, the second query module is specifically used to form the database query statement based on the semantic information, the database query statement including a data definition language and financial indicators.
[0019] A third aspect of this application provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.
[0020] A fourth aspect of this application also provides a computer-readable storage medium having a computer program or instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.
[0021] The fifth aspect of this application also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.
[0022] To address the technical issue of AI illusion that can easily occur when using large models for knowledge-based question answering in the financial field, embodiments of this application match the received query text with various tags in a pre-defined document library. Upon successful matching, the corresponding query results are obtained, and the large model generates the response information to be returned to the client. The beneficial effects of this application are: This application achieves data querying through tag-matching data, rather than directly querying data from multiple tables through a large model. This significantly limits the scope of the queried data and improves query accuracy. It avoids the limitations of large models when processing excessive data, preventing AI illusion caused by excessive queried data, resulting in more accurate question-and-answer results that align with the characteristics of knowledge-based question answering in the financial field. Attached Figure Description
[0023] The above-mentioned contents, other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0024] Figure 1 The illustrations depict application scenarios of knowledge question-answering methods, apparatuses, devices, media, and program products according to embodiments of this application.
[0025] Figure 2 A flowchart illustrating a knowledge question-answering method according to an embodiment of this application is shown schematically.
[0026] Figure 3 A flowchart illustrating another knowledge question-answering method according to an embodiment of this application is shown schematically;
[0027] Figure 4 A flowchart illustrating a knowledge question-answering method according to an embodiment of this application is shown schematically;
[0028] Figure 5 A flowchart illustrating another knowledge question-answering method according to an embodiment of this application is shown schematically;
[0029] Figure 6 This schematically illustrates a structural block diagram of a knowledge question-answering device according to an embodiment of this application; and
[0030] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing a knowledge question-answering method according to an embodiment of this application. Detailed Implementation
[0031] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0032] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0033] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0034] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0035] Existing question-answering models expand the storage, application adaptation, and scheduling capabilities of large models through contextual memory, knowledge / table indexing, prompt word engineering, agent execution, and general toolsets. They further enhance the professional capabilities of large models by incorporating knowledge and best practices from fields such as finance, taxation, human resources, supply chain, and R&D, enabling professionally relevant question answering. However, due to the ambiguity and polysemy of natural language, models may misunderstand the user's query intent, resulting in query results that do not meet the user's expectations.
[0036] The current approach typically uses a large model for multi-table queries. However, large models often perform poorly in scenarios involving multi-table joins. For example, in practice, if there are more than five tables, the join results will become skewed, leading to discrepancies in both query results and question / answer content.
[0037] This application provides a knowledge question answering method, which receives query text from a user; performs a first query operation based on the query text to query a preset knowledge base; wherein the preset document base includes data to be queried and tags corresponding to the data to be queried, the first query operation includes matching the query text with the tags to query the corresponding data to be queried; if the first query operation is successful, obtains a first query result; and forms answer information based on the first query result.
[0038] To address the technical issue of AI illusion that can easily occur when using large models for knowledge-based question answering in the financial field, embodiments of this application match the received query text with various tags in a pre-defined document library. Upon successful matching, the corresponding query results are obtained, and the large model generates the response information to be returned to the client. The beneficial effects of this application are: This application achieves data querying through tag-matching data, rather than directly querying data from multiple tables through a large model. This significantly limits the scope of the queried data and improves query accuracy. It avoids the limitations of large models when processing excessive data, preventing AI illusion caused by excessive queried data, resulting in more accurate question-and-answer results that align with the characteristics of knowledge-based question answering in the financial field.
[0039] Figure 1 The diagram illustrates an application scenario of the knowledge question-answering method according to an embodiment of this application.
[0040] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0041] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0042] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0043] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0044] It should be noted that the knowledge question-answering method provided in this application embodiment can generally be executed by server 105. Correspondingly, the knowledge question-answering device provided in this application embodiment can generally be located in server 105. The knowledge question-answering method provided in this application embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the knowledge question-answering device provided in this application embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.
[0045] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0046] The following will be based on Figure 1 The described scene, through Figures 2-5 The knowledge question-answering method according to the embodiments of this application will be described in detail.
[0047] Figure 2 A flowchart illustrating a knowledge question-and-answer method according to an embodiment of this application is shown.
[0048] like Figure 2 As shown, the knowledge question-and-answer method of this embodiment includes operations S210 to S240, and the transaction processing method can be executed by server 105.
[0049] In operation S210, a query text from the user is received.
[0050] The system receives query text from users, which can be used as input for question-and-answer sessions. In a typical scenario, users can input their questions as query text to engage in financial knowledge Q&A. During the Q&A process, if a user wants to learn about a specific financial theory, they can input related questions as prompts. The query text can contain not only specific financial knowledge but also other limiting elements for the answer. For example, the query text could be "methods for calculating operating profit," or "methods for calculating operating profit, with a practical example including a bar chart, etc."
[0051] In operation S220, a first query operation is performed based on the query text to query a preset knowledge base; wherein, the preset document base includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried.
[0052] The aforementioned pre-defined knowledge base can be a vector database, storing a vast amount of financial knowledge. Different pieces of financial knowledge correspond to specific tags (or indicators). Each piece of financial knowledge can correspond to one or more tags. Matching the query text with these different financial knowledge tags is achieved by calculating similarity. If the matching criteria are met, the query result can be used as the first query result. For example, by vectorizing the query text and calculating its similarity to various pieces of financial knowledge in the knowledge base, one or more pieces of financial knowledge with a similarity greater than a preset threshold can be selected as the query result.
[0053] The aforementioned pre-set knowledge base is pre-established. The establishment process includes storing data from multiple sources into a document library, then performing operations such as document segmentation, data connection, and indexing on these documents to form different financial knowledge. Next, the text-to-vector conversion process is performed to vectorize this data, thereby converting it into word vectors. Finally, it is stored in the knowledge base.
[0054] In a typical scenario, a financial knowledge base is established as the aforementioned pre-defined knowledge base. Relevant pattern information is periodically extracted to construct dictionaries and indexes for subsequent pattern mapping queries. Specifically, firstly, the financial knowledge base is acquired, which can be divided into three parts: a public financial knowledge base, a personal financial knowledge base, and a financial system knowledge base. The three bases can be interoperable and shared, facilitating use in various scenarios. The data for this financial knowledge base can be imported from multiple external systems via interfaces. Next, document preparation is performed. During document preparation, the financial knowledge base stores relevant knowledge from various financial fields, such as accounting standards, tax laws, and financial theories, in a document library. Through document segmentation components and by calling the text vectorization interface of the large model, key information and features are extracted, and the text (including words, sentences, and paragraphs) is represented as a vector matrix. The similarity between texts is calculated and stored in a vector database. In the user question-and-answer phase, users can submit questions to the system by inputting text. The system will parse the user's questions and return the best answer. Of course, the documents in the financial knowledge base need to support fine-grained access control and hierarchical authorization management, including upload, preview, edit, download, print, and management permissions, which can be allocated according to different dimensions such as roles and positions.
[0055] According to an embodiment of this application, the first query operation includes: matching the query text with the tag using a preset pattern mapper; and, if the query text matches the tag, obtaining the corresponding data to be queried as the first query result.
[0056] Building upon direct vector matching through full text, a pattern mapper can be added for more accurate tag matching. The pattern mapper extracts key data from the query text and performs matching. Specifically, it matches tags in the knowledge base using pattern matching on the received query text. This involves word segmentation and part-of-speech tagging to identify key data, which is then used to match tags. This key data includes at least the entities in the text and the relationships between them. In a typical scenario, for the input query text, indicator entities, dimension entities, and operational intents are extracted. Then, precise matching and / or synonym matching (e.g., matching through vector similarity calculation) are performed between these entities and tags in the knowledge base. After successful tag matching, multiple query data can be generated as the first query result, taking into account the context. It's important to note that the pattern mapper is maintained by relevant personnel to ensure its focus on pattern recognition in financial knowledge.
[0057] In the embodiments of this application, the first query operation includes matching tags in the database through a preset pattern mapper. If a tag is matched, the corresponding data is directly obtained as the query result. By matching tags through a custom mapper, there is no need to use a large model to perform inference, thus improving the accuracy of matching.
[0058] In operation S230, if the first query operation is successful, the first query result is obtained.
[0059] During the first query operation, if at least one piece of data to be queried is successfully matched, the first query operation is considered successful, and the financial knowledge in the knowledge base is directly retrieved as the query result. During the query, a similarity calculation can be used to determine whether the similarity to the tag is higher than a preset similarity threshold, thus determining whether a tag match is successful.
[0060] In operation S240, answer information is generated based on the first query result.
[0061] After obtaining the first query result, the large model interface can be called using the data from this result. The large model then processes the first query result to generate an answer. Specifically, when calling the large model interface, the output answer can be limited by incorporating the hints extracted from the query document.
[0062] To address the technical issue of AI illusion that can easily occur when using large models for knowledge-based question answering in the financial field, embodiments of this application match the received query text with various tags in a pre-defined document library. Upon successful matching, the corresponding query results are obtained, and the large model generates the response information to be returned to the client. The beneficial effects of this application are: This application achieves data querying through tag-matching data, rather than directly querying data from multiple tables through a large model. This significantly limits the scope of the queried data and improves query accuracy. It avoids the limitations of large models when processing excessive data, preventing AI illusion caused by excessive queried data, resulting in more accurate question-and-answer results that align with the characteristics of knowledge-based question answering in the financial field.
[0063] Understandably, if the first query operation fails to retrieve data, another query operation needs to be used to ensure the feasibility of the solution, as shown below:
[0064] Figure 3 A flowchart illustrating another knowledge question-answering method according to an embodiment of this application is shown schematically.
[0065] like Figure 3 As shown, the knowledge question-answering method in this embodiment includes operations S310 to S330.
[0066] In operation S310, if the first query operation fails, a second query operation is performed to query a preset document library; wherein, the second query operation includes generating a query statement from the query text to query the preset document library.
[0067] This pre-defined document library differs from the aforementioned knowledge base. While it also stores financial knowledge, it is a non-vector-based database. Users can extract semantics from query text to generate database queries, enabling precise searches of the pre-defined document library. These queries include statements such as SELECT, WHERE, and FROM, which manipulate data within the database, thus facilitating direct data retrieval.
[0068] According to an embodiment of this application, the second query operation includes: parsing the query text to obtain semantic information; forming a database query statement based on the semantic information to query the data to be queried in the preset document library; and, if the database query statement is successful, obtaining the corresponding data as the second query result.
[0069] Semantic information is extracted from the text to identify the user's intent. This semantic information includes at least various financial knowledge entities and the financial relationships between these entities. Then, these entities and relationships are interpreted to form corresponding database query statements. For example, logical decomposition is performed first; then multiple query tasks and the relationships between them are identified; secondly, this semantic information can be further constrained to standard financial information; finally, different query statements are generated to achieve data retrieval.
[0070] In the embodiments of this application, the semantics of the query text are extracted and a direct query statement for querying the database is formed based on the semantics. With this query result, there is no need to infer the query statement through a large model, which ensures the independence of the large model and avoids errors in the query statement.
[0071] According to an embodiment of this application, parsing the query text to obtain semantic information includes: extracting the semantic information of the query text based on preset keyword rules.
[0072] Financial information can be extracted directly using preset keywords, or using synonyms of preset keywords. These keyword rules can be differentiated according to different financial domains to extract entities and relationships within that domain. It's important to note that while keyword rules include both entities and relationships, structured data is extracted when extracting semantic information. Essentially, the keywords in the keyword rules ensure that relevant content can be retrieved from the document library using a query.
[0073] In the embodiments of this application, financial-related keyword rules can be pre-set to extract semantic information from the query text. The keywords include financial knowledge keywords as well as data definition language keywords, thereby avoiding data illusion.
[0074] According to an embodiment of this application, parsing the query text to obtain semantic information further includes: extracting semantic information from the query text based on calling a large model interface.
[0075] By directly calling the large model interface to extract the query text and restricting the prompt words for semantic information extraction, the semantic information in the query text can be extracted. This allows the large model to participate in the knowledge base query process, making full use of the advantages of the large model to improve query efficiency and increase the accuracy of semantic extraction.
[0076] According to an embodiment of this application, the step of forming a database query statement based on the semantic information to query the data to be queried in the preset document library includes: forming the database query statement based on the semantic information, wherein the database query statement includes a data definition language and financial indicators.
[0077] Specifically, based on this semantic information, database query statements are assembled, wherein the generated database query statements include the format of Data Definition Language (or DDL) and corresponding financial indicators.
[0078] In the embodiments of this application, based on this semantic information, corresponding query statements can be directly formed to query the database.
[0079] In operation S320, if the second query operation is successful, the second query result is obtained.
[0080] If a query returns data after retrieving data from the document library, the query is considered successful; otherwise, if no results are returned, the query is considered unsuccessful.
[0081] In operation S330, answer information is generated based on the second query result.
[0082] After obtaining the second query result, the data from this result can be used to call the large model interface, allowing the large model to process the second query result and generate an answer. Specifically, when calling the large model interface, the output answer can be limited by incorporating the prompt words extracted from the query text.
[0083] In the embodiments of this application, in addition to the first query operation, a second query operation can also be set up. The second query operation is executed when the first query operation fails. It directly queries the database using a database query statement, reducing the complexity of the query and making the output query results more accurate.
[0084] Figure 4 A flowchart illustrating a knowledge question-answering method according to an embodiment of this application is shown schematically.
[0085] like Figure 4 As shown, when a user inputs a query, the financial knowledge base contains descriptions of all corresponding tables. The query statement is then assembled with the knowledge base for processing by a large model. This query process includes semantic modeling, which can be performed based on the database query statement. After constructing the semantic layer, the semantics of the data are returned to the user or the large model. This solution primarily enables question-and-answer dialogue, assistant management, plugin management, semantic modeling, indicator market, tag market, database management, system settings, and operational monitoring. Simultaneously, supporting engineering components are introduced around the large model to enhance the reliability of semantic parsing and database query statement generation. The architecture in this embodiment does not require the large model to infer the database query statement; it only needs to retrieve and match data from indicators and tags through the semantic model to perform database queries.
[0086] Figure 5 A flowchart illustrating another knowledge question-answering method according to an embodiment of this application is shown schematically.
[0087] like Figure 5 As shown, in Figure 5 The supporting components include a financial knowledge base, a schema mapper, a semantic parser, a semantic corrector, a semantic interpreter, and a question-answering plugin.
[0088] The financial knowledge base is responsible for periodically extracting relevant pattern information from the semantic model to build a dictionary and index for subsequent pattern mapping. The pattern mapper matches natural language text within the knowledge base, providing relevant information for subsequent semantic parsing. The semantic parser understands user queries and extracts semantic information; it consists of a set of rule-based and model-based parsers, each capable of handling different specific scenarios. The semantic corrector checks the legality of semantic information, correcting and optimizing invalid information. The semantic interpreter generates physical database query statements based on semantic information and executes the queries. Question-answering plugins extend functionality through third-party tools. Given all configured plugins, their functional descriptions, and example questions, the large language model will select the most suitable plugin.
[0089] When building a financial knowledge base, corresponding indicators or tags can be created based on semantic modeling. These indicators are then vectorized and placed in a vector library. When a user asks a question, the question is matched against the vector database in the financial knowledge base using a pattern mapper. If a match is found, the corresponding indicator is invoked to retrieve the data. If no match is found using vectors, a database query is generated through function calls to retrieve the data. It is understood that this embodiment encapsulates the traditional large-scale semantic modeling layer separately, making it independent of the large model and focusing more on the user's intent. It combines semantic indicators for vector retrieval and matching, and once a match is found, it invokes the corresponding semantic model to execute the corresponding database query.
[0090] In general, on the one hand, before the user question-and-answer phase, each financial subsystem needs to conduct database connection tests and semantic modeling. Then, based on the user's prompts, the corresponding indicators are found in the indicator and tag markets, and the corresponding indicator is retrieved from the semantic modeling to complete the answer to the user's question. On the other hand, this solution requires regular operational monitoring of the usage rates of the indicator and tag markets. Indicators or tags with low usage rates should be cleaned up or optimized to improve hit efficiency and save resources.
[0091] Based on the above-mentioned knowledge question answering method, this application also provides a knowledge question answering device. The following will combine... Figure 6 The device is described in detail.
[0092] Figure 6 A schematic block diagram of a knowledge question-answering device according to an embodiment of this application is shown.
[0093] like Figure 6 As shown, the knowledge question-answering device 600 of this embodiment includes a receiving module 610, a first query module 620, a result acquisition module 630, and an answering module 640.
[0094] The receiving module 610 is used to receive query text from the user. In one embodiment, the receiving module 610 can be used to perform the operation S210 described above, which will not be repeated here.
[0095] The first query module 620 is used to perform a first query operation based on the query text, querying a preset knowledge base; wherein, the preset document base includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried. In one embodiment, the first query module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0096] The result acquisition module 630 is used to acquire the first query result if the first query operation is successful. In one embodiment, the result acquisition module 630 can be used to execute the operation S230 described above, which will not be repeated here.
[0097] The answer module 640 is used to form answer information based on the first query result. In one embodiment, the answer module 640 can be used to perform the operation S240 described above, which will not be repeated here.
[0098] To address the technical issue of AI illusion that can easily occur when using large models for knowledge-based question answering in the financial field, embodiments of this application match the received query text with various tags in a pre-defined document library. Upon successful matching, the corresponding query results are obtained, and the large model generates the response information to be returned to the client. The beneficial effects of this application are: This application achieves data querying through tag-matching data, rather than directly querying data from multiple tables through a large model. This significantly limits the scope of the queried data and improves query accuracy. It avoids the limitations of large models when processing excessive data, preventing AI illusion caused by excessive queried data, resulting in more accurate question-and-answer results that align with the characteristics of knowledge-based question answering in the financial field.
[0099] According to an embodiment of this application, the device further includes: a second query module, configured to perform a second query operation to query a preset document library when the first query operation fails; wherein the second query operation includes generating a query statement through the query text to query the preset document library; a result acquisition module, further configured to acquire a second query result when the second query operation succeeds; and an answer module, further configured to form answer information based on the second query result.
[0100] According to an embodiment of this application, the first query module is specifically used to match the query text with the tag through a preset pattern mapper; and when the query text matches the tag, to obtain the corresponding query data as the first query result.
[0101] According to an embodiment of this application, the second query module is specifically used to parse the query text to obtain semantic information; form a database query statement based on the semantic information to query the data to be queried in the preset document library; and, if the database query statement is successful, obtain the corresponding data as the second query result.
[0102] According to an embodiment of this application, the second query module is specifically used to extract semantic information of the query text based on preset keyword rules.
[0103] According to an embodiment of this application, the second query module is specifically used to extract semantic information from the query text based on calling the large model interface.
[0104] According to an embodiment of this application, the second query module is specifically used to form the database query statement based on the semantic information, the database query statement including a data definition language and financial indicators.
[0105] According to embodiments of this application, any multiple modules among the receiving module 610, the first query module 620, the result acquisition module 630, and the response module 640 can be combined into one module, or any one of these modules can be split into multiple modules. Alternatively, at least some of the functions of one or more of these modules can be combined with at least some of the functions of other modules and implemented in one module. According to embodiments of this application, at least one of the receiving module 610, the first query module 620, the result acquisition module 630, and the response module 640 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the receiving module 610, the first query module 620, the result acquisition module 630, and the answer module 640 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0106] Figure 7 A block diagram schematically illustrates an electronic device suitable for implementing a knowledge question-answering method according to an embodiment of this application.
[0107] like Figure 7 As shown, an electronic device 900 according to an embodiment of this application includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage portion 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.
[0108] RAM 903 stores various programs and data required for the operation of electronic device 900. Processor 901, ROM 902, and RAM 903 are interconnected via bus 904. Processor 901 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 902 and / or RAM 903. It should be noted that the programs may also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in said one or more memories.
[0109] According to embodiments of this application, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to a bus 904. The electronic device 900 may also include one or more of the following components connected to the input / output (I / O) interface 905: an input section 906 including a keyboard, mouse, etc.; an output section 907 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 910 as needed so that computer programs read from it can be installed into the storage section 908 as needed.
[0110] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0111] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium, such as including but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of this application, the computer-readable storage medium may include ROM 902 and / or RAM 903 and / or one or more memories other than ROM 902 and RAM 903 described above.
[0112] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of this application.
[0113] When the computer program is executed by the processor 901, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0114] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and downloaded and installed via the communication section 909, and / or installed from a removable medium 911. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0115] In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, it performs the functions defined in the system of this application embodiment. According to the embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0116] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0117] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0118] Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in this application. In particular, the features described in the various embodiments of this application can be combined and / or combined in various ways without departing from the spirit and teachings of this application. All such combinations and / or combinations fall within the scope of this application.
Claims
1. A knowledge-based question-and-answer method, characterized in that, The method includes: Receive query text from the user; A first query operation is performed based on the query text to query a preset knowledge base; wherein, the preset document base includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried; If the first query operation is successful, obtain the first query result; and Answer information is generated based on the first query result.
2. The method according to claim 1, characterized in that, After performing a first query operation based on the query text and querying a preset knowledge base, the method further includes: If the first query operation fails, a second query operation is performed to query a preset document library; wherein, the second query operation includes generating a query statement from the query text to query the preset document library; If the second query operation is successful, obtain the second query result; and Answer information is generated based on the second query result.
3. The method according to claim 1, characterized in that, The first query operation includes: The query text is matched against the tags using a preset pattern mapper; If the query text matches the tag, the corresponding query data is obtained as the first query result.
4. The method according to claim 2, characterized in that, The second query operation includes: The query text is parsed to obtain semantic information; Based on the semantic information, a database query statement is generated to query the data to be queried in the preset document library; and If the database query is successful, the corresponding data is obtained as the second query result.
5. The method according to claim 4, characterized in that, The process of parsing the query text to obtain semantic information includes: Based on preset keyword rules, the semantic information of the query text is extracted.
6. The method according to claim 4, characterized in that, The process of parsing the query text to obtain semantic information also includes: Based on calling the large model interface, semantic information is extracted from the query text.
7. The method according to claim 4, characterized in that, The step of forming a database query statement based on the semantic information to query the data to be queried in the preset document library includes: Based on the semantic information, the database query statement is formed, which includes a data definition language and financial indicators.
8. A knowledge-based question-and-answer device, characterized in that, The device includes: The receiving module is used to receive query text from users; The first query module is used to perform a first query operation based on the query text to query a preset knowledge base; wherein, the preset document library includes data to be queried and tags corresponding to the data to be queried, and the first query operation includes matching the query text with the tags to query the corresponding data to be queried; The result retrieval module is used to retrieve the first query result if the first query operation is successful; and The answer module is used to generate answer information based on the first query result.
9. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 7.