CN113408298B - Semantic analysis method, semantic analysis device, electronic equipment and storage medium - Google Patents

Semantic analysis method, semantic analysis device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113408298B
CN113408298B CN202110737345.5A CN202110737345A CN113408298B CN 113408298 B CN113408298 B CN 113408298B CN 202110737345 A CN202110737345 A CN 202110737345A CN 113408298 B CN113408298 B CN 113408298B
Authority
CN
China
Prior art keywords
question
sql
clause
fragments
segment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110737345.5A
Other languages
Chinese (zh)
Other versions
CN113408298A (en
Inventor
王丽杰
肖欣延
常月
李婷婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110737345.5A priority Critical patent/CN113408298B/en
Publication of CN113408298A publication Critical patent/CN113408298A/en
Application granted granted Critical
Publication of CN113408298B publication Critical patent/CN113408298B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Software Systems (AREA)
  • Biophysics (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a semantic parsing method, a semantic parsing device, electronic equipment and a storage medium, and relates to the field of artificial intelligence such as natural language processing and deep learning, wherein the method can comprise the following steps: encoding the input problem and the corresponding database; generating SQL query sentences according to the coding result, wherein for any SQL clause, the following processing is respectively carried out: determining a question segment corresponding to the SQL clause in the question; and generating the SQL clause according to the question segment. By applying the scheme disclosed by the invention, the accuracy and the like of the generated SQL query statement can be improved.

Description

Semantic analysis method, semantic analysis device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of artificial intelligence, in particular to a semantic analysis method, a semantic analysis device, electronic equipment and a storage medium in the fields of natural language processing, deep learning and the like.
Background
Semantic parsing (Text-to-SQL) is a core technology of language understanding, aimed at automatically converting natural language questions into structured query language (SQL, structured Query Language) query statements that can interact with databases.
Wherein executable SQL query statements may be generated based on the entered questions and corresponding databases. At present, when an SQL query statement is generated, the information referenced by different SQL clauses is the same, so that elements with high matching degree with the input problems in the database can be selected by a plurality of grammars with high probability, and the elements which should be selected are not selected, thereby reducing the accuracy of the generated SQL query statement and the like.
Disclosure of Invention
The disclosure provides a semantic parsing method, a semantic parsing device, electronic equipment and a storage medium.
A semantic parsing method, comprising:
Encoding the input problem and the corresponding database;
Generating a Structured Query Language (SQL) query statement according to the coding result, wherein for any SQL clause, the following processing is respectively carried out:
Determining a question segment corresponding to the SQL clause in the question;
and generating the SQL clause according to the question segment.
A semantic parsing apparatus comprising: the device comprises an encoding module and a generating module;
the coding module is used for coding the input problems and the corresponding databases;
The generating module is configured to generate a structured query language SQL query statement according to a coding result, where for any SQL clause, the following processes are performed respectively: determining a question segment corresponding to the SQL clause in the question; and generating the SQL clause according to the question segment.
An electronic device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described above.
A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a method as described above.
A computer program product comprising a computer program which, when executed by a processor, implements a method as described above.
One embodiment of the above disclosure has the following advantages or benefits: when the SQL query statement is generated, different SQL clauses are respectively selected to be referenced, so that the problems in the prior art are overcome, the accuracy of the generated SQL query statement is improved, and the like.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a flow chart of an embodiment of a semantic parsing method according to the present disclosure;
FIG. 2 is a schematic diagram of a tree corresponding to a certain SQL query statement of the disclosure;
FIG. 3 is a schematic diagram of a database according to the present disclosure;
FIG. 4 is a schematic diagram of an overall implementation process of the semantic parsing method according to the present disclosure;
fig. 5 is a schematic structural diagram of a semantic parsing device 500 according to an embodiment of the present disclosure;
Fig. 6 illustrates a schematic block diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In addition, it should be understood that the term "and/or" herein is merely one association relationship describing the associated object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Fig. 1 is a flowchart of an embodiment of a semantic parsing method according to the present disclosure. As shown in fig. 1, the following detailed implementation is included.
In step 101, the inputted questions and corresponding databases are encoded.
In step 102, an SQL query statement is generated according to the encoding result, wherein for any SQL clause, processing is performed in a manner shown in steps 103-104, respectively.
In step 103, a question segment corresponding to the SQL clause in the question is determined.
In step 104, the SQL clause is generated from the determined question segment.
It can be seen that the above embodiment of the method provides a semantic parsing manner based on the concept of segment alignment, and when an SQL query statement is generated, different SQL clauses can respectively select corresponding problem segments for reference, so that the problems in the prior art are overcome, and the accuracy of the generated SQL query statement is improved.
The generated SQL query statement is usually a grammar sequence, the grammar sequence can be expressed as a tree, and the sequence obtained by the depth-first traversal of the tree is the grammar sequence.
Fig. 2 is a schematic diagram of a tree corresponding to a certain SQL query statement in the present disclosure, as shown in fig. 2, and it is assumed that the SQL query statement is: population density of the pearl sea (SELECT population/area (km 2) FROM T1 WHERE NAME = 'pearl sea'), where T1 represents table 1 in the database, i.e. a table about chinese city (CHINA CITIES).
Fig. 3 is a schematic diagram of a database according to the present disclosure. As shown in fig. 3, in addition to table 1, table 2 (T2) and the like may be further included in the database, that is, a plurality of different tables may be included in the database.
For the input problem, it may first be encoded with the corresponding database. For example, the input problems can be spliced with the corresponding databases for encoding.
How the encoding is performed is not limited, and for example, a Long Short-Term Memory (LSTM) model or a converter (transducer) frame-based model may be used for the encoding. The model based on the transducer frame may be a model obtained by performing fine-tuning (fine-tuning) based on a pre-trained model. The pre-training model may be any commonly used pre-training model.
Further, an SQL query statement may be generated from the encoding results. For any SQL clause, the question segment corresponding to the SQL clause in the input questions can be determined respectively, and the SQL clause can be generated according to the determined question segment.
To this end, in one embodiment of the present disclosure, the input question may be split, resulting in at least two question segments. Each problem segment typically has relatively complete semantics.
In addition, some of the content may be repeated in different question segments. For example, the input problems are: giving a wine name (GIVE THE NAMES of WINES WITH PRICES above any wine produced in 2006) of any wine produced at a price higher than 2006, which may include the following problem fragments: wine names (GIVE THE NAMES of wines), wine (WINES WITH PRICES above any wine) and wine produced in 2006 are given.
Correspondingly, for any SQL clause, when the question segment corresponding to the SQL clause in the input questions needs to be determined, the question segment corresponding to the SQL clause can be selected from the at least two question segments.
How to segment the input question and how to select the question segment corresponding to the SQL clause is not limited. For example, as one possible implementation manner, training of the model may be performed in advance, so that the model learns how to segment the input problem and how to select the problem segment corresponding to the SQL clause. Thus, after training is completed, the model can segment any input problem according to the learned capability, and different question segments corresponding to SQL clauses can be selected.
When training the model, the input problem can be manually segmented to obtain a plurality of problem segments, or an automatic segmentation and manual correction mode can be adopted, or the model can completely learn how to segment and the like.
For any SQL clause, the corresponding question segment is the question segment most aligned with the SQL clause.
Each SQL clause corresponds to a subtree, as shown in fig. 2, which includes SQL clauses such as selection (Select) and filtering (Where), and it can be seen that each SQL clause corresponds to a subtree.
In one embodiment of the present disclosure, different SQL clauses may correspond to different question segments. Assuming that 3 question segments and 3 SQL clauses are included, for convenience of description, the question segments are called question segment 1, question segment 2 and question segment 3, respectively, and the SQL clause 1, SQL clause 2 and SQL clause 3, the question segment corresponding to the SQL clause 2 will be question segment 2 or question segment 3, and the question segment corresponding to the SQL clause 3 will be question segment 2, assuming that the question segment corresponds to the question segment 1.
That is, if one question segment is selected, the question segment is not selected again, so that each question segment in the input question can be used, information in the question is prevented from being lost, and the accuracy of the SQL query statement generated later is improved.
For any SQL clause, after determining the corresponding question segment, the SQL clause can be generated according to the corresponding question segment.
In one embodiment of the disclosure, for any SQL clause, a question segment corresponding to the SQL clause may be used as a main reference object, other question segments in the input question may be used as auxiliary reference objects, and the SQL clause may be generated by combining the main reference object and the auxiliary reference objects.
In one embodiment of the disclosure, the specific manner of using the question segment corresponding to the SQL clause as a main reference object and using other question segments in the input question as auxiliary reference objects may be: the weight of the question segment corresponding to the SQL clause is set to be higher than the weight of other question segments in the input questions.
Assuming that there are three question segments in total, for convenience of description, these are respectively referred to as question segment 1, question segment 2 and question segment 3, taking the SQL clause of Select shown in fig. 2 as an example, after determining the corresponding question segment, the weight of question segment 1 may be set higher than the weights of question segment 2 and question segment 3, accordingly, when generating the SQL clause, reference may be mainly made to question segment 1, but question segment 2 and question segment 3 may be combined at the same time, so that both the information in question segment 1 and question segment 2 and question segment 3 are considered at the same time, thereby ensuring the accuracy of the generated SQL clause, and the like.
How to generate the SQL clause is not limited, e.g., a syntax-decoding-based tree generation algorithm may be employed. For any SQL clause, the generation of the SQL clause can be completed based on the corresponding problem fragment and the like, including the generation of grammars and database elements therein.
Based on the above description, fig. 4 is a schematic diagram of an overall implementation process of the semantic parsing method according to the present disclosure.
As shown in fig. 4, the input questions and corresponding databases may be encoded, for example, using LSTM models or models based on a transducer framework. Among them, the problem of input is assumed to be "how much more the normal population is than the sea of pearls (How many more people ARE THERE IN HEFEI THEN IN Zhuhai)".
As shown in fig. 4, the input problem may be further segmented to obtain at least two problem segments, where the number of the obtained problem segments depends on the actual situation.
As shown in fig. 4, when the SQL query statement may be further generated, the following processing may be performed for each SQL clause, respectively: firstly, determining a question segment corresponding to the SQL clause, namely selecting the question segment corresponding to the SQL clause from the at least two question segments, and then generating the SQL clause according to the determined question segment. Different SQL clauses may correspond to different question segments, respectively.
Specifically, for each SQL clause, the question segment corresponding to the SQL clause may be used as a main reference object, and other question segments may be used as auxiliary reference objects, for example, the question segment corresponding to the SQL clause may be weighted higher than the other question segments, and then the SQL clause may be generated in combination with the main reference object and the auxiliary reference object.
After the processing, aiming at the input problem 'How many more people ARE THERE IN HEFEI THEN IN Zhuhai', a final SQL query statement can be obtained as follows:
SELECT a-b FROM
(SELECT population FROM T1 WHERE name=‘Hefei’)a,
(SELECT population FROM T1 WHERE name=‘Zhuhai’)b。
Subsequently, the obtained SQL query statement can be executed, so that an answer corresponding to the input question is obtained.
The specific implementation of the process shown in fig. 4 is referred to the foregoing related description, and will not be repeated.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present disclosure is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present disclosure. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all of the preferred embodiments, and that the acts and modules referred to are not necessarily required by the present disclosure.
The foregoing is a description of embodiments of the method, and the following further describes embodiments of the present disclosure through examples of apparatus.
Fig. 5 is a schematic structural diagram of a semantic parsing device 500 according to an embodiment of the present disclosure. As shown in fig. 5, includes: encoding module 501 and generating module 502.
The encoding module 501 is configured to encode the input problem and the corresponding database.
The generating module 502 is configured to generate an SQL query statement according to the encoding result, where for any SQL clause, the following processes may be performed respectively: determining a question segment corresponding to the SQL clause in the question; and generating the SQL clause according to the determined problem fragment.
For the input questions, the encoding module 501 may encode them with the corresponding database, e.g., may splice the input questions with the corresponding database for encoding.
Further, the generation module 502 may generate an SQL query statement according to the encoding result. For any SQL clause, the question segment corresponding to the SQL clause in the input questions can be determined respectively, and the SQL clause can be generated according to the determined question segment.
For this purpose, the generating module 502 may further segment the input question, so as to obtain at least two question segments, and accordingly, for any SQL clause, the question segment corresponding to the SQL clause may be selected from the at least two question segments.
For any SQL clause, the corresponding question segment is the question segment most aligned with the SQL clause.
Different SQL clauses may correspond to different question segments, respectively. That is, a problem segment is selected and not selected again.
For any SQL clause, after determining the corresponding question segment, the SQL clause can be generated according to the corresponding question segment. Specifically, for any SQL clause, the question segment corresponding to the SQL clause can be used as a main reference object, and other question segments in the input questions can be used as auxiliary reference objects, so that the SQL clause can be generated by combining the main reference object and the auxiliary reference objects.
The specific way of taking the question segment corresponding to the SQL clause as a main reference object and taking other question segments in the input questions as auxiliary reference objects can be as follows: the weight of the question segment corresponding to the SQL clause is set to be higher than the weight of other question segments in the input questions.
How to generate the SQL clause is not limited, e.g., a syntax-decoding-based tree generation algorithm may be employed. For any SQL clause, the generation of the SQL clause can be completed based on the corresponding problem fragment and the like, including the generation of grammars and database elements therein.
The specific workflow of the embodiment of the apparatus shown in fig. 5 is referred to the related description in the foregoing method embodiment, and will not be repeated.
In summary, by adopting the scheme of the embodiment of the disclosure, a semantic parsing mode based on the concept of segment alignment is provided, and when an SQL query statement is generated, different SQL clauses can respectively select corresponding problem segments for reference, so that the problems in the prior art are overcome, and the accuracy of the generated SQL query statement is improved.
The scheme disclosed by the disclosure can be applied to the field of artificial intelligence, and particularly relates to the fields of natural language processing, deep learning and the like.
Artificial intelligence is the subject of studying certain thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.) that make a computer simulate a person, and has technology at both hardware and software levels, and artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, etc., and artificial intelligence software technologies mainly include computer vision technologies, speech recognition technologies, natural language processing technologies, machine learning/deep learning, big data processing technologies, knowledge graph technologies, etc.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 6 illustrates a schematic block diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile apparatuses, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing apparatuses. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 may also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other by a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Various components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, mouse, etc.; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the methods described in this disclosure. For example, in some embodiments, the methods described in the present disclosure may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. One or more steps of the methods described in this disclosure may be performed when a computer program is loaded into RAM 603 and executed by computing unit 601. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the methods described in the present disclosure in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of large management difficulty and weak service expansibility in the traditional physical hosts and Virtual Private Servers (VPSs). The server may also be a server of a distributed system or a server that incorporates a blockchain. Cloud computing refers to a technology system which is used for accessing an elastically extensible shared physical or virtual resource pool through a network, resources can comprise a server, an operating system, a network, software, application, storage equipment and the like, and can be deployed and managed in an on-demand and self-service mode, and by means of cloud computing technology, high-efficiency and powerful data processing capacity can be provided for technical application and model training of artificial intelligence, blockchain and the like.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (4)

1.A semantic parsing method, comprising:
encoding the inputted questions with the corresponding database, comprising: splicing the problems with the database together for encoding;
Generating a Structured Query Language (SQL) query statement according to the coding result, wherein for any SQL clause, the following processing is respectively carried out:
Determining a question segment corresponding to the SQL clause in the question, including: determining unselected question segments from at least two question segments obtained by segmenting the question, and selecting the question segment corresponding to the SQL clause from the unselected question segments; different SQL clauses respectively correspond to different question segments;
Generating the SQL clause from the question segment includes: taking the question segment corresponding to the SQL clause as a main reference object, taking other question segments in the question as auxiliary reference objects, generating the SQL clause by combining the main reference object and the auxiliary reference object, wherein,
And setting the weight of the question segment corresponding to the SQL clause to be higher than the weight of other question segments in the question.
2. A semantic parsing apparatus comprising: the device comprises an encoding module and a generating module;
The encoding module is configured to encode an input problem and a corresponding database, and includes: splicing the problems with the database together for encoding;
The generating module is configured to generate a structured query language SQL query statement according to a coding result, where for any SQL clause, the following processes are performed respectively: determining a question segment corresponding to the SQL clause in the question, including: determining unselected problem fragments from at least two problem fragments obtained by segmenting the problem, selecting the problem fragments corresponding to the SQL clauses from the unselected problem fragments, wherein different SQL clauses respectively correspond to different problem fragments; generating the SQL clause from the question segment includes: and taking the problem fragments corresponding to the SQL clauses as main reference objects, taking other problem fragments in the problem as auxiliary reference objects, and generating the SQL clauses by combining the main reference objects and the auxiliary reference objects, wherein the weights of the problem fragments corresponding to the SQL clauses are higher than the weights of the other problem fragments in the problem.
3. An electronic device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of claim 1.
4. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of claim 1.
CN202110737345.5A 2021-06-30 2021-06-30 Semantic analysis method, semantic analysis device, electronic equipment and storage medium Active CN113408298B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110737345.5A CN113408298B (en) 2021-06-30 2021-06-30 Semantic analysis method, semantic analysis device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110737345.5A CN113408298B (en) 2021-06-30 2021-06-30 Semantic analysis method, semantic analysis device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113408298A CN113408298A (en) 2021-09-17
CN113408298B true CN113408298B (en) 2024-05-31

Family

ID=77680538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110737345.5A Active CN113408298B (en) 2021-06-30 2021-06-30 Semantic analysis method, semantic analysis device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113408298B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090762B (en) * 2022-01-21 2022-06-03 浙商期货有限公司 Automatic question-answering method and system in futures field

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110945495A (en) * 2017-05-18 2020-03-31 易享信息技术有限公司 Conversion of natural language queries to database queries based on neural networks
CN112132420A (en) * 2020-09-04 2020-12-25 广西大学 SQL query-oriented refinement scoring method
CN112506949A (en) * 2020-12-03 2021-03-16 北京百度网讯科技有限公司 Method and device for generating query statement of structured query language and storage medium
CN112559552A (en) * 2020-12-03 2021-03-26 北京百度网讯科技有限公司 Data pair generation method and device, electronic equipment and storage medium
CN112632256A (en) * 2020-12-29 2021-04-09 平安科技(深圳)有限公司 Information query method and device based on question-answering system, computer equipment and medium
CN112687388A (en) * 2021-01-08 2021-04-20 中山依数科技有限公司 Interpretable intelligent medical auxiliary diagnosis system based on text retrieval
CN112988785A (en) * 2021-05-10 2021-06-18 浙江大学 SQL conversion method and system based on language model coding and multitask decoding
CN113032418A (en) * 2021-02-08 2021-06-25 浙江大学 Method for converting complex natural language query into SQL (structured query language) based on tree model

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110945495A (en) * 2017-05-18 2020-03-31 易享信息技术有限公司 Conversion of natural language queries to database queries based on neural networks
CN112132420A (en) * 2020-09-04 2020-12-25 广西大学 SQL query-oriented refinement scoring method
CN112506949A (en) * 2020-12-03 2021-03-16 北京百度网讯科技有限公司 Method and device for generating query statement of structured query language and storage medium
CN112559552A (en) * 2020-12-03 2021-03-26 北京百度网讯科技有限公司 Data pair generation method and device, electronic equipment and storage medium
CN112632256A (en) * 2020-12-29 2021-04-09 平安科技(深圳)有限公司 Information query method and device based on question-answering system, computer equipment and medium
CN112687388A (en) * 2021-01-08 2021-04-20 中山依数科技有限公司 Interpretable intelligent medical auxiliary diagnosis system based on text retrieval
CN113032418A (en) * 2021-02-08 2021-06-25 浙江大学 Method for converting complex natural language query into SQL (structured query language) based on tree model
CN112988785A (en) * 2021-05-10 2021-06-18 浙江大学 SQL conversion method and system based on language model coding and multitask decoding

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于列表监督的Hash排序算法;杨安邦;钱江波;董一鸿;陈华辉;;电信科学;20190423(第05期);84-91页 *
数据库SQL审查与性能优化技术研究与应用;杭聪;黄连月;黄鑫;;电力信息与通信技术(第04期);146-153 *

Also Published As

Publication number Publication date
CN113408298A (en) 2021-09-17

Similar Documents

Publication Publication Date Title
US20220292269A1 (en) Method and apparatus for acquiring pre-trained model
US11907671B2 (en) Role labeling method, electronic device and storage medium
EP4148727A1 (en) Speech recognition and codec method and apparatus, electronic device and storage medium
CN114281968B (en) Model training and corpus generation method, device, equipment and storage medium
US20230084055A1 (en) Method for generating federated learning model
US20230013796A1 (en) Method and apparatus for acquiring pre-trained model, electronic device and storage medium
US20220358955A1 (en) Method for detecting voice, method for training, and electronic devices
CN116257690A (en) Resource recommendation method and device, electronic equipment and storage medium
CN113641724B (en) Knowledge tag mining method and device, electronic equipment and storage medium
CN113408298B (en) Semantic analysis method, semantic analysis device, electronic equipment and storage medium
CN114758649B (en) Voice recognition method, device, equipment and medium
US11989516B2 (en) Method and apparatus for acquiring pre-trained model, electronic device and storage medium
US20220188163A1 (en) Method for processing data, electronic device and storage medium
CN115510203A (en) Question answer determining method, device, equipment, storage medium and program product
CN113033179B (en) Knowledge acquisition method, knowledge acquisition device, electronic equipment and readable storage medium
CN114973333A (en) Human interaction detection method, human interaction detection device, human interaction detection equipment and storage medium
CN114550692A (en) Text processing and training method, device, equipment and storage medium of model thereof
CN113689866A (en) Training method and device of voice conversion model, electronic equipment and medium
CN114239583A (en) Method, device, equipment and medium for training entity chain finger model and entity chain finger
CN114119972A (en) Model acquisition and object processing method and device, electronic equipment and storage medium
CN113553413A (en) Dialog state generation method and device, electronic equipment and storage medium
CN112905777B (en) Extended query recommendation method and device, electronic equipment and storage medium
CN113553863B (en) Text generation method, device, electronic equipment and storage medium
JP7551970B2 (en) Artificial intelligence model updating method, apparatus, electronic device and storage medium
CN113689867B (en) Training method and device of voice conversion model, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant