A voice interactive database query method, device and medium

Through the voice interactive database query method, query statements are generated using natural language processing model, which solves the problem of low query efficiency caused by manual creation of query statements and realizes efficient database query.

CN118152514BActive Publication Date: 2025-04-11成都虚谷伟业科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410156307.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-02-04
Publication Date
2025-04-11
Estimated Expiration
2044-02-04

AI Technical Summary

Technical Problem

In the prior art, it is necessary to manually create query statements to obtain the data required by the user, resulting in low query efficiency.

Method used

By receiving the voice signal input by the user, the text is obtained through recognition, and the natural language processing model that has been trained has been generated, and it is executed in the target database to obtain the query results.

Benefits of technology

No need to create query statements manually, which improves the efficiency of database queries and can quickly and accurately obtain the data required by users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118152514B_ABST
    Figure CN118152514B_ABST
Patent Text Reader

Abstract

The present application discloses a voice interactive database query method, device and medium, which receive a voice signal input by a user, recognize the voice signal, obtain text, obtain a query statement based on the text and a trained natural language processing model, execute the query statement in a target database, and obtain a query result matching the query statement. The present solution provides a database query method with high query efficiency, which at least solves the technical problem of obtaining the data required by the user by manually creating query statements, resulting in low query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a voice interactive database query method, device and medium. Background Art

[0002] A query statement is an SQL statement used to retrieve data from a database. It allows users to filter data based on specific conditions and return records that meet these conditions. By using a query statement, specific data can be obtained from the database based on specified conditions and requirements. The query statement can be used to select specific columns, filter data, sort results, etc. It can help users quickly and accurately obtain the required data.

[0003] Currently, it is necessary to manually create query statements to obtain the data required by users, and the query efficiency is low. Summary of the invention

[0004] The main purpose of the present application is to provide a voice interactive database query method, device and medium, aiming to solve the technical problem of obtaining the data required by the user by manually creating query statements, resulting in low query efficiency.

[0005] The present invention provides a voice interactive database query method, comprising the following steps:

[0006] Receiving a first voice signal, where the first voice signal refers to a voice signal input by a first user;

[0007] Recognizing the first voice signal to obtain a first text;

[0008] Obtaining a first query statement according to the first text and the trained natural language processing model;

[0009] The first query statement is executed in a first target database to obtain a query result matching the first query statement.

[0010] Optionally, the step of recognizing the first voice signal to obtain a first text includes:

[0011] Preprocessing the first speech signal to obtain a second speech signal;

[0012] The second voice signal is recognized by a first voice recognition engine to obtain a first text.

[0013] Optionally, before the step of obtaining a first query statement according to the first text and the trained natural language processing model, the following steps are included:

[0014] Build an initial natural language processing model;

[0015] Acquire first data in the first target database and a first parameter corresponding to the first data, wherein the first data refers to an identifier in the first target database, and the first parameter is used to characterize relevant information of the first data;

[0016] Obtaining a first data set for training the initial natural language processing model according to the first data and the first parameter;

[0017] According to the first data set, a trained natural language processing model is obtained.

[0018] Optionally, the step of acquiring first data in the first target database and a first parameter corresponding to the first data includes:

[0019] Traversing the first target database, obtaining at least one identifier in the first target database as first data;

[0020] According to the first data and a preset first mapping relationship, a first parameter corresponding to the first data is obtained.

[0021] Optionally, the step of obtaining a first query statement according to the first text and the trained natural language processing model includes:

[0022] Obtaining at least one first keyword according to the first text and the trained natural language processing model;

[0023] A first query statement is obtained according to the at least one keyword.

[0024] Optionally, it also includes a preset second mapping relationship;

[0025] The step of obtaining a first query statement according to the at least one keyword includes:

[0026] According to the at least one keyword and a preset second mapping relationship, obtaining at least one query field corresponding to the at least one keyword;

[0027] A first query statement is obtained according to the at least one query field.

[0028] Optionally, a pre-trained query generation model is also included;

[0029] The step of obtaining a first query statement according to the at least one keyword includes:

[0030] A model is generated according to the at least one keyword and the pre-trained query statement to obtain a first query statement.

[0031] Optionally, before the step of generating a model according to the at least one keyword and the pre-trained query statement to obtain the first query statement, the step includes:

[0032] Construct an initial query statement generation model;

[0033] Acquire a second data set for training the initial query statement generation model;

[0034] A query statement generation model that has completed training is obtained according to the second data set.

[0035] In another aspect, a voice interactive database query device comprises:

[0036] A voice signal receiving module, configured to receive a first voice signal, wherein the first voice signal refers to a voice signal input by a first user;

[0037] A voice signal recognition module, used to recognize the first voice signal to obtain a first text;

[0038] A query statement acquisition module is used to acquire a first query statement according to the first text and the trained natural language processing model;

[0039] The query result acquisition module is used to execute the first query statement in the first target database to obtain query results matching the first query statement.

[0040] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program is processed and executed to implement any of the above methods.

[0041] The present application discloses a voice interactive database query method, which receives a voice signal input by a user, recognizes the voice signal, obtains text, obtains a query statement based on the text and a trained natural language processing model, executes the query statement in a target database, and obtains a query result matching the query statement. With this solution, there is no need to manually create a query statement, and the text obtained by recognizing the voice signal can be brought into the trained natural language processing model to obtain keywords related to the text, and obtains a query statement based on the keywords related to the text. This solution provides a database query method with high query efficiency, which at least solves the technical problem of obtaining the data required by the user by manually creating a query statement, resulting in low query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the specific implementation of the present application or the technical solution in the prior art, the following is a brief introduction to the drawings required for the specific implementation or the prior art description. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.

[0043] Figure 1 A flowchart of a voice interactive database query method for this application;

[0044] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the scheme of the present disclosure, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present disclosure.

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0047] Reference Figure 1 , a voice interactive database query method, executed by a query statement management platform, comprises the following steps:

[0048] S1. Receive a first voice signal, where the first voice signal refers to a voice signal input by a first user;

[0049] Optionally, the first user can input a voice signal on the terminal or on the audio device. The first voice signal refers to a voice signal input by the first user, which includes the query requirement of the first user. For example, a user inputs a voice signal on the terminal of "get the name of the most expensive product among the top three slow-selling products in the past week".

[0050] S2. Recognize the first voice signal to obtain a first text;

[0051] Optionally, the first voice signal is preprocessed to obtain a second voice signal, and the second voice signal is recognized by a first voice recognition engine to obtain a first text, where the second voice signal refers to the preprocessed voice signal, the first voice recognition engine refers to a voice recognition engine used to recognize the second voice signal, and the first text refers to the text form of the first voice signal, which contains text information of the first user's query requirement. For example, the voice signal of "the name of the most expensive product among the top three slow-selling products in the past week" is recognized by the voice recognition engine to obtain the text form of "the name of the most expensive product among the top three slow-selling products in the past week", that is, the first text.

[0052] S3. Obtain a first query statement according to the first text and the trained natural language processing model;

[0053] Optionally, an initial natural language processing model is constructed, and a connection with a first target database is established. The first target database may be a local database or a database in another server. First data in the first target database and a first parameter corresponding to the first data may be obtained through a crawler, or the first data in the first target database and a first parameter corresponding to the first data may be obtained through a query statement. A first data set is obtained based on the first data and the first parameter. The first data set includes data for training the initial natural language processing model. The initial natural language processing model is trained based on the first data set to obtain a trained natural language processing model. At least one keyword may be obtained based on the first text and the trained natural language processing model. A second mapping may be preset based on the at least one keyword. relationship, obtain at least one query field corresponding to at least one keyword, obtain a first query statement according to the at least one query field, or generate a model according to at least one keyword and a pre-trained query statement to obtain the first query statement; the first data refers to an identifier in the first target database, that is, a variable name in a data table of the first target database, for example, "sales volume", "price", "quantity", the first parameter refers to a plurality of parameters corresponding to the first data, used to characterize relevant information of the first data, for example, the first parameter corresponding to "sales volume" may be "sales revenue", "sales volume", "unsalable", and the first parameter corresponding to "price" may be "unit price", "cost", "purchase price"; the preset second mapping relationship refers to the mapping relationship between keywords and query fields and the mapping relationship between keywords and data table names.

[0054] S4. Execute the first query statement in the first target database to obtain a query result matching the first query statement.

[0055] Optionally, execute the first query statement in the first target database to obtain a query result matching the first query statement, clean the query result to obtain a target query result, convert the target query result into text form, and send the target query result in text form to the terminal of the first user.

[0056] Optionally, the step of recognizing the first voice signal to obtain a first text includes:

[0057] Preprocessing the first speech signal to obtain a second speech signal;

[0058] The second voice signal is recognized by a first voice recognition engine to obtain a first text.

[0059] Optionally, the first voice signal refers to the original voice signal input by the first user. In order to more clearly identify the voice signal input by the user, it is necessary to preprocess the first voice signal, pre-emphasize the high-frequency part of the first voice signal, and denoise the pre-emphasized first voice signal to eliminate the noise in the first voice signal. The first voice signal after denoising is framed and windowed to reduce spectrum leakage to obtain a second voice signal. The second voice signal is recognized by the first voice recognition engine to obtain the first text. The second voice signal refers to the preprocessed voice signal.

[0060] Optionally, before the step of obtaining a first query statement according to the first text and the trained natural language processing model, the following steps are included:

[0061] Build an initial natural language processing model;

[0062] Acquire first data in the first target database and a first parameter corresponding to the first data, wherein the first data refers to an identifier in the first target database, and the first parameter is used to characterize relevant information of the first data;

[0063] Obtaining a first data set for training the initial natural language processing model according to the first data and the first parameter;

[0064] According to the first data set, a trained natural language processing model is obtained.

[0065] Optionally, an initial natural language processing model is constructed, the first data in all data tables of the first target database are traversed, a first parameter corresponding to the first data is obtained according to the first data and a preset first mapping relationship, a first data set is created, the first data and the first parameter are stored in the first data set, and an initial natural language processing model is trained according to the first data set to obtain a trained natural language processing model; the first data refers to an identifier in the first target database, that is, a variable name in a data table of the first target database, the first parameter refers to an attribute of the first data, and the first parameter is used to characterize relevant information of the first data;

[0066] Optionally, the step of acquiring first data in the first target database and a first parameter corresponding to the first data includes:

[0067] Traversing the first target database, obtaining at least one identifier in the first target database as first data;

[0068] According to the first data and a preset first mapping relationship, a first parameter corresponding to the first data is obtained.

[0069] Optionally, a crawler can be used to traverse all variable names in all data tables of the first target database to obtain at least one variable name, where an identifier refers to a variable name in a data table of the first target database. The at least one identifier is used as the first data, and a first parameter corresponding to the first data is obtained based on the first data and a preset first mapping relationship. The first parameter may be multiple parameters corresponding to the first data, and the first mapping relationship refers to a mapping relationship between the first data and the first parameter.

[0070] Optionally, the step of obtaining a first query statement according to the first text and the trained natural language processing model includes:

[0071] Obtaining at least one first keyword according to the first text and the trained natural language processing model;

[0072] A first query statement is obtained according to the at least one keyword.

[0073] Optionally, the trained natural language processing model includes a text parsing module and a semantic understanding module. The first text is brought into the trained natural language processing model, and the first text is divided into multiple words or multiple phrases through the text parsing module in the trained natural language processing model, and the part of speech of each word or each phrase is marked. There are multiple parts of speech, such as nouns, verbs, or adjectives, etc. The named entities in the first text are identified. There are multiple named entities, such as names of people, places, or names of organizations, etc. For example, when the first text is "the name of the most expensive product among the top three slow-selling products in the past week", the text in the trained natural language processing model is used to identify the named entities. The parsing module divides the first text into "recently", "within a week", "unsaleable", "top three", "commodity", "price", "most expensive", "commodity", and "name". Through this module, "recently" is marked as an adverb, "within a week" is marked as a time phrase, "unsaleable" is marked as a verb, "commodity" is marked as a noun, "price" is marked as a noun, "most expensive" is marked as an adjective, and "name" is marked as a noun. The module identifies the named entities in the first text. At this time, the named entities in the first text are "commodity price" and "commodity name". Through the semantic understanding module in the trained natural language processing model, according to the above multiple words, the part of speech of each word and the above-mentioned named entity, identify the intention of the first user, that is, determine whether the above-mentioned word or the above-mentioned named entity is the first data. If the above-mentioned word or the above-mentioned named entity is not the first data, it means that the variable name represented by the word or the named entity does not exist in the data table of the first target database, and it is necessary to obtain the first data corresponding to the word or the named entity according to the word or the named entity, and replace the word or the named entity with the first data. For example, the word "unsalable" is not the first data, and it is necessary to obtain the first data "sales volume" corresponding to "unsalable", and replace "unsalable" with "sales volume"; according to the above-mentioned multiple words or first data, each The parts of speech of the words and the above-mentioned named entities are used to obtain the intention of the first user. For example, based on the multiple words in the above examples: "within a week", "sales volume", "top three", "commodity", "price", "most expensive", "commodity", "name", the parts of speech of each word and the named entities: "commodity price", "commodity name", the intention of the first user is identified. At this time, the intention of the first user is "the name of the most expensive commodity in the last three places ranked in reverse order of sales volume in the past week"; at least one keyword in the intention of the first user is extracted, and a first query statement is obtained based on the at least one keyword. The first query statement refers to a query statement that can be executed in the first target database.

[0074] Optionally, it also includes a preset second mapping relationship;

[0075] The step of obtaining a first query statement according to the at least one keyword includes:

[0076] According to the at least one keyword and a preset second mapping relationship, obtaining at least one query field corresponding to the at least one keyword;

[0077] A first query statement is obtained according to the at least one query field.

[0078] Optionally, at least one query field corresponding to at least one keyword is obtained according to at least one keyword and a preset second mapping relationship. Alternatively, a data table name corresponding to the keyword is obtained according to the keyword and the preset second mapping relationship. Specific data matching the keyword is stored in the data table. For example, when the keyword is "product price", the data table name "p" corresponding to "product price" is obtained according to the preset second mapping relationship. If the keyword is ambiguous, that is, the keyword covers a large range, it is necessary to further limit the ambiguous keyword according to the intention of the first user. For example, the keyword "within the past week" does not specify that it is within the past week of a certain object. Therefore, it is necessary to further limit the keyword "within the past week" according to the intention of the first user. At this time, the intention of the first user is "the name of the most expensive product in the last three places ranked in reverse order of sales volume within the past week". According to the intention of the first user, it can be obtained that the keyword "within the past week" refers to the "within the past week" of product sales. The query field corresponding to the "within the past week" of product sales is "SELECT product_id FROM t_sales WHERE sale_date>=DATE_SUB(NOW(),INTERVAL 1WEEK) GROUP BY The query field for "product_id" is "SUM(sale_quantity)" for "sales volume", "ORDER BY xxxx DESC" for "descending ranking", "ORDER BY xxxx ASCLIMIT 3" for "last three digits", "ORDER BY p.product_price DESC LIMIT 1" for "most expensive", and "SELECT p.product_name FROM t_products" for "product name". p"; if a keyword corresponds to multiple data table names, then according to the multiple data table names corresponding to the keyword, the variable names in each data table are traversed to obtain the same variable names stored in different data tables, and the conditions for connecting multiple tables are set according to the same variable names stored in different data tables. According to the query fields corresponding to other keywords and the conditions for connecting multiple tables, the first query statement is generated. For example, the data table names corresponding to "product name" are "t_products" and "t_sales". After traversing the "t_products" data table and the "t_sales" data table, it can be obtained that the variable name "product_id" is stored in both data tables. According to the variable name, the condition for connecting the "t_products" data table and the "t_sales" data table is set, and the condition is "FROM t_products JOIN t_sales ON t_products.product_id=t_sales.product_id”, based on the query field corresponding to the above keyword and the condition, the first query statement is generated, and the first query statement is as follows:.

[0079] "SELECT p.product_name

[0080] FROM t_products pJOIN(

[0081] SELECT product_id

[0082] FROM t_sales

[0083] WHERE sale_date>=DATE_SUB(NOW(),INTERVAL 1WEEK)

[0084] GROUP BY product_id

[0085] ORDER BY SUM(sale_quantity)ASC

[0086] LIMIT 3

[0087] )s ON p.product_id=s.product_id

[0088] ORDER BY p.product_price DESCLIMIT 1;”

[0089] Optionally, a pre-trained query generation model is also included;

[0090] The step of obtaining a first query statement according to the at least one keyword includes:

[0091] A model is generated according to the at least one keyword and the pre-trained query statement to obtain a first query statement.

[0092] Optionally, an initial query statement generation model is constructed, a second data set for training the initial query statement generation model is obtained, and the initial query statement generation model is trained based on the second data set to obtain a trained query statement generation model; the second data set includes preset keywords and preset query fields corresponding to the keywords.

[0093] Optionally, before the step of generating a model according to the at least one keyword and the pre-trained query statement to obtain the first query statement, the step includes:

[0094] Construct an initial query statement generation model;

[0095] Acquire a second data set for training the initial query statement generation model;

[0096] A query statement generation model that has completed training is obtained according to the second data set.

[0097] Optionally, after obtaining the second data set for training the initial query statement generation model, it is necessary to clean and preprocess the data in the second data set, fill in missing values ​​in the second data set, modify abnormal values ​​in the second data set, and delete duplicate values ​​in the second data set.

[0098] Example 2

[0099] This embodiment provides a voice interactive database query device, which is characterized by comprising:

[0100] A voice signal receiving module, configured to receive a first voice signal, wherein the first voice signal refers to a voice signal input by a first user;

[0101] A voice signal recognition module, used to recognize the first voice signal to obtain a first text;

[0102] A query statement acquisition module is used to acquire a first query statement according to the first text and the trained natural language processing model;

[0103] The query result acquisition module is used to execute the first query statement in the first target database to obtain query results matching the first query statement.

[0104] Example 3

[0105] This embodiment provides a specific implementation solution based on Embodiment 1.

[0106] The query statement management platform receives a first voice signal input by a first user. The first user may input the voice signal on a terminal or on an audio device. The first voice signal refers to a voice signal input by the first user, and includes the query requirement of the first user. For example, a user inputs a voice signal on a terminal to "obtain the name of the most expensive product among the top three slow-selling products in the past week";

[0107] The query statement management platform preprocesses the first voice signal to obtain a second voice signal, and recognizes the second voice signal through the first voice recognition engine to obtain a first text, wherein the second voice signal refers to the preprocessed voice signal, the first voice recognition engine refers to the voice recognition engine used to recognize the second voice signal, and the first text refers to the text form of the first voice signal, which contains the text information of the first user's query demand. For example, the voice signal of "the most expensive product name among the top three slow-selling products in the past week" is recognized by the voice recognition engine to obtain the text form of "the most expensive product name among the top three slow-selling products in the past week", that is, the first text;

[0108] The query statement management platform constructs an initial natural language processing model and establishes a connection with a first target database. The first target database may be a local database or a database in another server. The first data in the first target database and the first parameter corresponding to the first data may be obtained through a crawler, or through a query statement. The first data refers to an identifier in the first target database, that is, a variable name in a data table of the first target database, such as "sales volume", "price", and "quantity". The first parameter refers to a plurality of parameters corresponding to the first data, which are used to characterize relevant information of the first data. For example, the first parameter corresponding to "sales volume" may be "sales volume", "sales volume", and "unsalable", and the first parameter corresponding to "price" may be "unit price", "cost", and "purchase price".

[0109] The query statement management platform creates a first data set, stores the first data and the first parameter in the first data set, cleans and preprocesses the data in the first data set, wherein the first data set after cleaning and preprocessing contains data for training an initial natural language processing model, and the initial natural language processing model is trained by the first data set to obtain a trained natural language processing model;

[0110] The query statement management platform brings the first text into a trained natural language processing model, which includes a text parsing module and a semantic understanding module. The first text is brought into the trained natural language processing model, and the first text is divided into multiple words or multiple phrases through the text parsing module in the trained natural language processing model, and the part of speech of each word or each phrase is marked. There are multiple parts of speech, such as nouns, verbs, or adjectives, etc. The named entities in the first text are identified. There are multiple named entities, such as names of people, places, or names of organizations, etc. The semantic understanding module in the trained natural language processing model is used to judge the intention of the first user based on the above multiple words, the part of speech of each word, and the named entities, and extract at least one keyword in the intention of the first user;

[0111] The query statement management platform can obtain a data table name corresponding to the keyword based on at least one keyword and a preset second mapping relationship, wherein the data table stores specific data matching the keyword. The query statement management platform can also obtain at least one query field corresponding to at least one keyword based on at least one keyword and a preset second mapping relationship. If the keyword is ambiguous, that is, the keyword covers a large range, it is necessary to further limit the ambiguous keyword according to the intention of the first user. For example, the keyword "within the past week" does not specify that it is within the past week of a certain object. Therefore, it is necessary to further limit the keyword "within the past week" according to the intention of the first user. At this time, the intention of the first user is "the last three in the reverse order of sales volume within the past week". The name of the most expensive product", according to the intention of the first user, it can be obtained that the keyword "within the past week" refers to the sales volume of the product "within the past week"; if a keyword corresponds to multiple data table names, then according to the multiple data table names corresponding to the keyword, the variable names in each data table are traversed to obtain the same variable names stored in different data tables, and the conditions for connecting multiple tables are set according to the same variable names stored in different data tables. According to the query fields corresponding to other keywords and the conditions for connecting multiple tables, a first query statement is generated, and a model can also be generated according to at least one keyword and a pre-trained query statement to obtain the first query statement; the preset second mapping relationship refers to the mapping relationship between keywords and query fields and the mapping relationship between keywords and data table names.

[0112] Example 4

[0113] This embodiment provides a computer-readable storage medium, on which a computer program is stored, and a processor executes the computer program to implement any of the above methods.

[0114] In some embodiments, the computer readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various devices including one or any combination of the above memories. The computer may be various computing devices including intelligent terminals and servers.

[0115] In the above embodiments of the present disclosure, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0117] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0118] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0119] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable non-volatile storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a non-volatile storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present disclosure. The aforementioned non-volatile storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0120] The above are only preferred embodiments of the present disclosure. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present disclosure. These improvements and modifications should also be regarded as the protection scope of the present disclosure.

Claims

1. A voice interactive database query method, characterized in that: The following steps are involved: Receiving a first voice signal, where the first voice signal refers to a voice signal input by a first user; Pre-emphasize the high frequency part of the first speech signal, perform noise reduction on the pre-emphasized first speech signal to eliminate the noise in the first speech signal, frame the first speech signal after noise reduction, and perform windowing on the framed first speech signal to obtain a second speech signal; Recognize the second voice signal by a first voice recognition engine to obtain a first text; Build an initial natural language processing model; Traversing a first target database, obtaining at least one identifier in the first target database as first data; obtaining a first parameter corresponding to the first data according to the first data and a preset first mapping relationship, wherein the first data refers to an identifier in the first target database, and the first parameter is used to characterize relevant information of the first data; Obtaining a first data set for training the initial natural language processing model according to the first data and the first parameter; Obtain at least one keyword according to the first text and the trained natural language processing model; obtain at least one query field corresponding to the at least one keyword according to the at least one keyword and a preset second mapping relationship; According to the at least one query field; Construct an initial query statement generation model; Acquire a second data set for training the initial query statement generation model; Obtaining a query statement generation model that has completed training according to the second data set; Generate a model according to the at least one query field and a pre-trained query statement to obtain a first query statement; Among them, the trained natural language processing model includes a text parsing module and a semantic understanding module; Based on the text parsing module, the first text is divided into a plurality of words or a plurality of phrases, the part of speech of each word or each phrase is marked, and the named entities in the first text are identified; Based on the semantic understanding module, judging whether the word, phrase or the named entity is the first data by the part of speech of the word, phrase and the named entity; If not, then according to the word, the phrase or the named entity, obtain first data corresponding to the word, the phrase or the named entity, and replace the word, the phrase or the named entity with the first data; The first query statement is executed in a first target database to obtain a query result matching the first query statement.

2. A voice interactive database query device, characterized in that: include: Speech signal recognition module: Receiving a first voice signal, where the first voice signal refers to a voice signal input by a first user; Pre-emphasize the high frequency part of the first speech signal, perform noise reduction on the pre-emphasized first speech signal to eliminate the noise in the first speech signal, frame the first speech signal after noise reduction, and perform windowing on the framed first speech signal to obtain a second speech signal; Recognize the second voice signal by a first voice recognition engine to obtain a first text; Get the query statement module: Build an initial natural language processing model; Traversing a first target database, obtaining at least one identifier in the first target database as first data; obtaining a first parameter corresponding to the first data according to the first data and a preset first mapping relationship, wherein the first data refers to an identifier in the first target database, and the first parameter is used to characterize relevant information of the first data; Obtaining a first data set for training the initial natural language processing model according to the first data and the first parameter; Obtain at least one keyword according to the first text and the trained natural language processing model; obtain at least one query field corresponding to the at least one keyword according to the at least one keyword and a preset second mapping relationship; According to the at least one query field; Construct an initial query statement generation model; Acquire a second data set for training the initial query statement generation model; Obtaining a query statement generation model that has completed training according to the second data set; Generate a model according to the at least one query field and a pre-trained query statement to obtain a first query statement; Get query result module: Among them, the trained natural language processing model includes a text parsing module and a semantic understanding module; Based on the text parsing module, the first text is divided into a plurality of words or a plurality of phrases, the part of speech of each word or each phrase is marked, and the named entities in the first text are identified; Based on the semantic understanding module, judging whether the word, phrase or the named entity is the first data by the part of speech of the word, phrase and the named entity; If not, then according to the word, the phrase or the named entity, obtain first data corresponding to the word, the phrase or the named entity, and replace the word, the phrase or the named entity with the first data; The first query statement is executed in a first target database to obtain a query result matching the first query statement.

3. A computer-readable storage medium having a computer program stored thereon, and processing and executing the computer program to implement the method according to claim 1.

Citation Information

Patent Citations

  • Application method and system of NER entity recognition algorithm in report query

    CN114238370A