CN116303971A - Few-sample form question-answering method oriented to bridge management and maintenance field - Google Patents

Few-sample form question-answering method oriented to bridge management and maintenance field Download PDF

Info

Publication number
CN116303971A
CN116303971A CN202310335356.XA CN202310335356A CN116303971A CN 116303971 A CN116303971 A CN 116303971A CN 202310335356 A CN202310335356 A CN 202310335356A CN 116303971 A CN116303971 A CN 116303971A
Authority
CN
China
Prior art keywords
question
maintenance
semantic analysis
representing
analysis model
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.)
Pending
Application number
CN202310335356.XA
Other languages
Chinese (zh)
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.)
Chongqing Jiaotong University
Original Assignee
Chongqing Jiaotong University
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 Chongqing Jiaotong University filed Critical Chongqing Jiaotong University
Priority to CN202310335356.XA priority Critical patent/CN116303971A/en
Publication of CN116303971A publication Critical patent/CN116303971A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/177Editing, e.g. inserting or deleting of tables; using ruled lines
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of bridge management and maintenance, in particular to a few-sample form question-answering method for the field of bridge management and maintenance, which comprises the following steps: constructing a question-SQL pair comprising a question text and an SQL query statement as a training sample, and marking; injecting entity relation knowledge in the bridge management and maintenance field into the problem text of the training sample; establishing a semantic analysis model which is input as a problem text and output as an SQL query statement, and pre-training the semantic analysis model through a training sample with labels; performing model fine adjustment on the pre-trained semantic analysis model to obtain a final semantic analysis model; and outputting SQL query sentences based on the given problem text through a final semantic analysis model to realize question answering. The invention can enable the model To learn the form and the method of the Text-To-SQL task of the form question and answer by constructing the pseudo data, and can enable the model To accurately identify the language table and the domain vocabulary in the bridge management and maintenance field.

Description

Few-sample form question-answering method oriented to bridge management and maintenance field
Technical Field
The invention relates to the field of bridge management and maintenance, in particular to a few-sample form question-answering method for the field of bridge management and maintenance.
Background
In the field of bridge management and maintenance, a large number of tables exist in a periodic detection report, and information such as fine-grained structural diseases, maintenance suggestions and the like is recorded in databases of a plurality of bridge management information systems, so that the intelligent management and maintenance system is an important foundation for realizing intelligent management and maintenance of bridges.
At present, a structured query language typified by an SQL query statement is a main way for accessing relational database data, but a common system user does not have a technical basis for writing the SQL query statement. In recent years, with the development of deep learning and big data processing technologies, natural language processing related algorithms and models are gradually applied to various fields.
As a branch of natural language processing, form questions and answers are obtained by matching natural language question sentences with structured or semi-structured information in a form by using document forms, databases and the like as data sources, and the answers have been widely used in the vertical industrial fields of medical treatment, finance and the like. However, the construction of the large-scale labeling data set is time-consuming and labor-consuming, and is strongly dependent on field experts, so that the application of the form question-answering method in the bridge management field is restricted, and the actual application effect of the form question-answering is poor. Meanwhile, the table question-answering method based on the universal field data set cannot accurately identify language tables and field words in the bridge management and maintenance field, and accurate answers to given questions are difficult to be made under the actual operation scene of bridge management and maintenance, so that the accuracy of the table question-answering in the bridge management and maintenance field is low. Therefore, how to design a method capable of improving the actual application effect and question-answering accuracy of the form questions and answers in the bridge management and maintenance field is a technical problem to be solved.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to solve the technical problems that: how To provide a few sample form question-answer method facing bridge management and maintenance field, the form and method of the form question-answer Text-To-SQL (i.e. question-To-SQL query statement) task can be learned by a model through constructing pseudo data, and language tables and field words of the bridge management and maintenance field can be accurately identified by the model, so that the practical application effect and question-answer accuracy of the form question-answer of the bridge management and maintenance field can be improved.
In order to solve the technical problems, the invention adopts the following technical scheme:
a few-sample form question-answering method for the bridge management and maintenance field comprises the following steps:
s1: constructing a question-SQL pair comprising a question text and an SQL query statement as a training sample, and marking;
s2: injecting entity relation knowledge in the bridge management and maintenance field into the problem text of the training sample;
s3: establishing a semantic analysis model which is input as a problem text and output as an SQL query statement, and pre-training the semantic analysis model through a training sample with labels;
s4: performing model fine adjustment on the pre-trained semantic analysis model to obtain a final semantic analysis model;
s5: and outputting SQL query sentences based on the given problem text through a final semantic analysis model to realize question answering.
Preferably, the problem-SQL pairs conforming to Chinese expressions are automatically generated by heuristic rules.
Preferably, the injection of the entity relationship knowledge in the bridge management and maintenance field is realized through the following steps:
s201: original input problem text Q= { Q based on knowledge graph recognition in bridge management and maintenance field 1 ,q 2 ,q 3 ,…,q n Domain entity e= { E in } 1 ,e 2 ,…,e m Dividing sentences by taking each domain entity as a breakpoint;
s202: searching the bridge management and maintenance domain knowledge graph according to the identified domain entity E to obtain a corresponding domain knowledge triplet set K= { K 1 ,k 2 ,…,k p },k=(e i ,r,e j ) R represents a connection entity e i And e j A relationship between;
s203: the first t triples are filtered through sorting and are combined into domain knowledge to be injected, and the triples k are converted into logic knowledge short sentences w to adapt to sentence coding modes of the problem text Q;
s204: entity e in question text Q i And splicing the corresponding knowledge phrases w to realize the injection of the entity relationship knowledge in the bridge management and maintenance field.
Preferably, the semantic parsing model is a Chinese form pre-training model SDCUP, which aims to solve the problem of alignment of explicit interactive relations between the problem text and the database form, namely the problem of mode linkage.
Preferably, the semantic analysis model predicts the mode dependency relationship between the problem text and the database table through the dual affine network;
the formula is described as follows:
Figure BDA0004156277290000021
Figure BDA0004156277290000022
Figure BDA0004156277290000023
Figure BDA0004156277290000024
Figure BDA0004156277290000025
Figure BDA0004156277290000026
Figure BDA0004156277290000027
Figure BDA0004156277290000028
Figure BDA0004156277290000029
wherein: c j A table column representing a database; q i Is a question token;
Figure BDA00041562772900000210
representing predicted directed edges q i <-c j Whether or not it is present; />
Figure BDA00041562772900000211
Representing the best label for predicting each directed edge; biaff (·) represents a dual affine attention mechanism;
Figure BDA00041562772900000212
representation c j The table columns are used as the starting points of the mode dependent directed edges; FFN (FFN) edge-head (c j ) Representing the computation of c over a single layer feed forward network j The table columns are used as the starting points of the mode dependent directed edges; FFN (FFN) label-head (c j ) Representing the computation of c over a single layer feed forward network j The table column pattern depends on the specific label; />
Figure BDA0004156277290000031
Representing prediction c j The table column pattern depends on the specific label; FFN (FFN) edge-dep (q i ) Representing computation of token q through a single layer feed forward network i As a pattern dependent directed edge endpoint; FFN (FFN) label-de (q l ) Representing computation of token q through a single layer feed forward network i Mode dependent specific tags; />
Figure BDA0004156277290000032
Representing token q l As a pattern dependent directed edge endpoint; />
Figure BDA0004156277290000033
Representing a predicted token l Mode dependent specific tags; />
Figure BDA0004156277290000034
Representing calculation of problem token by Biaff (& gt) l And table column c j Directed edge connection between the two; />
Figure BDA0004156277290000035
Representing calculation of problem token by Biaff (& gt) i And table column c j Directed edge dependency labels between; u, W, b are all learnable parameters.
Preferably, the loss function of the semantic parsing model is as follows:
Figure BDA0004156277290000036
wherein: l represents a loss value of semantic analysis model training; cross EntropyLoss represents the cross entropy loss function;
Figure BDA0004156277290000037
representing the best label for predicting each directed edge; />
Figure BDA0004156277290000038
Representing predicted directed edges q i <-c j Whether or not it is present;
Figure BDA0004156277290000039
representing the true directed edges and specific dependency type labels.
Preferably, the semantic analysis model is subjected to model fine adjustment by designing the template coding problem and the mode information of the template.
Preferably, the given question text is input into a final semantic analysis model, a corresponding SQL query sentence is output, and then the corresponding SQL query sentence is executed in an SQL engine, so that an answer of the given question text is obtained.
Compared with the prior art, the method for asking and answering the few-sample table facing the bridge management and maintenance field has the following beneficial effects:
the invention constructs the question-SQL pair containing the question Text and the SQL query statement, namely the pseudo data (artificial question-SQL data), so that the semantic analysis model can learn the form and the method of the task of the form question-To-SQL (namely the question-To-SQL query statement) through constructing the pseudo data, further the problems that the construction of the labeling data set is time-consuming and labor-consuming and depends on domain experts strongly can be solved, and the effectiveness and the practical application effect of the form question-and-answer in the bridge management domain can be improved.
According to the method, the entity relation knowledge in the bridge management and maintenance field is injected into the problem text of the training sample, so that the semantic analysis model trained by the training sample can accurately identify the language table and the field vocabulary in the bridge management and maintenance field, further, the automatic alignment of the problem text and the table column in the bridge management and maintenance field and the accurate linkage of the problem mode can be realized, and the question and answer accuracy of the question and answer of the table in the bridge management and maintenance field can be improved.
According To the invention, the semantic analysis model is pre-trained through the labeled training sample, so that the semantic analysis model of Text-To-SQL (namely, problem To SQL query statement) can be trained by using a small amount of labeled data, namely, the training of a small sample can be realized, and further, the consumption of manpower and material resources can be reduced, thereby improving the training efficiency of the semantic analysis model and reducing the training difficulty.
According to the invention, the pre-trained semantic analysis model is subjected to model fine adjustment to obtain a final semantic analysis model, so that the application effect of form question-answering in a few-sample scene can be improved through model fine adjustment, and the intelligent retrieval, knowledge reasoning and information fusion capabilities of the semantic analysis model in the few-sample scene are improved, namely, the accuracy of bridge management and maintenance form question-answering can be effectively improved under the conditions of few samples and low resources, and the actual application effect and question-answering accuracy of the form question-answering in the bridge management and maintenance field can be further improved.
Drawings
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings, in which:
FIG. 1 is a logic block diagram of a few sample form question-answering method oriented to the field of bridge management;
FIG. 2 is an exemplary diagram of a semantic parsing model schema link;
FIG. 3 is a flow chart of knowledge injection in the field of bridge farming.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. In the description of the present invention, it should be noted that, directions or positional relationships indicated by terms such as "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., are directions or positional relationships based on those shown in the drawings, or are directions or positional relationships conventionally put in use of the inventive product, are merely for convenience of describing the present invention and simplifying the description, and are not indicative or implying that the apparatus or element to be referred to must have a specific direction, be constructed and operated in a specific direction, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance. Furthermore, the terms "horizontal," "vertical," and the like do not denote a requirement that the component be absolutely horizontal or overhang, but rather may be slightly inclined. For example, "horizontal" merely means that its direction is more horizontal than "vertical" and does not mean that the structure must be perfectly horizontal, but may be slightly tilted. In the description of the present invention, it should also be noted that, unless explicitly specified and limited otherwise, the terms "disposed," "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
The following is a further detailed description of the embodiments:
examples:
the embodiment discloses a few-sample form question-answering method facing the bridge management and maintenance field.
As shown in fig. 1, the few-sample form question-answering method for the bridge management and maintenance field comprises the following steps:
s1: constructing a question-SQL pair containing a question text and an SQL query statement from a structured and semi-structured table as a training sample, and marking;
in this embodiment, the training samples include a basic information query, a multi-condition query, a count information query, and a maximum information query.
S2: injecting entity relation knowledge in the bridge management and maintenance field into the problem text of the training sample;
s3: establishing a semantic analysis model which is input as a problem text and output as an SQL query statement, and pre-training the semantic analysis model through a training sample with labels;
s4: performing model fine adjustment on the pre-trained semantic analysis model to obtain a final semantic analysis model;
s5: and outputting SQL query sentences based on the given problem text through a final semantic analysis model to realize question answering.
Specifically, the given question text is input into a final semantic analysis model, a corresponding SQL query sentence is output, and then the corresponding SQL query sentence is executed in an SQL engine, so that an answer of the given question text is obtained.
The invention constructs the question-SQL pair containing the question Text and the SQL query statement, namely the pseudo data (artificial question-SQL data), so that the semantic analysis model can learn the form and the method of the task of the form question-To-SQL (namely the question-To-SQL query statement) through constructing the pseudo data, further the problems that the construction of the labeling data set is time-consuming and labor-consuming and depends on domain experts strongly can be solved, and the effectiveness and the practical application effect of the form question-and-answer in the bridge management domain can be improved.
According to the invention, through injecting the knowledge of the entity relation in the bridge management and maintenance field into the problem text of the training sample, the semantic analysis model trained by the training sample can accurately identify the language table and the field vocabulary in the bridge management and maintenance field, so that the automatic alignment of the problem text and the table column in the bridge management and maintenance field and the accurate linkage of the problem mode (the mode of the invention is a table, and the accurate linkage of the problem mode is the accurate linkage of the problem text and the table) can be realized, and the question and answer accuracy of the question and answer of the table in the bridge management and maintenance field can be improved.
According To the invention, the semantic analysis model is pre-trained through the labeled training sample, so that the semantic analysis model of Text-To-SQL (namely, problem To SQL query statement) can be trained by using a small amount of labeled data, namely, the training of a small sample can be realized, and further, the consumption of manpower and material resources can be reduced, thereby improving the training efficiency of the semantic analysis model and reducing the training difficulty. Meanwhile, the pre-trained semantic analysis model is subjected to model fine adjustment to obtain a final semantic analysis model, so that the application effect of form question-answering under a few sample scene can be improved through model fine adjustment, the intelligent retrieval, knowledge reasoning and information fusion capabilities of the semantic analysis model under the few sample scene are improved, namely the accuracy of bridge management form question-answering can be effectively improved under the conditions of few samples and low resources, and the actual application effect and question-answering accuracy of the form question-answering in the bridge management field can be further improved.
In this embodiment, when the training sample is labeled, the labeled label is the SQL query statement corresponding to the problem. The tag type, namely the specific dependency type of the problem text and the table column link, is used for training the directed edge of the semantic analysis model and the corresponding tag thereof to find the interaction relation between the natural language problem and the database table column, and helping the model to locate the column mentioned by the problem and the mentioned mode thereof so as to generate the corresponding SQL sentence later.
The label types are predefined 17, and the specific types and descriptions are shown in table 1.
Table 1 schema dependent tag introduction
Figure BDA0004156277290000061
In the specific implementation process, a problem-SQL pair conforming to Chinese expression is automatically generated through heuristic rules.
In this embodiment, heuristic rules refer to a simple rule or principle based on experience or common sense, which is used to guide the problem solving or decision making process. It is not a strict mathematical formula or algorithm, but a conventional way of thinking, typically perfected and improved by trial and error methods and continuous iterations.
The design of heuristic rules is based on the following principle:
simplicity of: heuristic rules should be straightforward and do not require complex computation or decision-making processes.
Operability of: heuristic rules should be easy to implement and apply, and help people make decisions or solve problems quickly.
Reliability: heuristic rules should be based on reliable data and evidence-based evidence to reduce misjudgments and misleading.
Flexibility: heuristic rules should have some flexibility to accommodate different problems and environments.
Interpretability: heuristic rules should be interpretable to clearly illustrate the underlying thought process and logic.
Common heuristic rules include "first-in-place", "similarity principle", "representative heuristic", etc., which are widely used in decision making, judgment and problem solving. Heuristic rules, while having certain limitations, can in many cases help us make decisions or solve problems quickly.
For the form question-answering task in the bridge management and maintenance field, questions are generally aimed at basic information, appearance inspection results, bridge technical condition assessment information and the like of the bridge, and the questions have pertinence and answering property and can be converted into legal SQL sentences. Such as: "what is the location of the Ding Jian ditch bridge? "," how many bridges are of the main girder type T-beam? "," how many bridges are rated 2015? ". The marked data comprise basic information inquiry, multi-condition inquiry, counting information inquiry, maximum information inquiry and the like. Because the computer cannot directly process the structured query language, the SQL part is converted into a logic form of a digital representation, and the SQL part and the logic form are the same in content and different in form.
Specific examples are as follows:
Figure BDA0004156277290000071
Figure BDA0004156277290000081
corresponding operator information:
agg_ops=[”,'avg','max','min','count','sum']
cond_ops=['>','<','==','!=']
cond_conn_op=[”,'and','or']
the question is, among other things, "what is the location of the t-family ditch bridge? "; "0" means that the "agg" query column corresponds to the aggregate operator subscript, and the problem does not involve an aggregate operation; "2" means "sel" queries the column subscript, i.e., the column subscript of "bridge location" in the table. [1,2, "t-home-channel" ] represents a conditional query triplet list corresponding to the "bridge name" column subscript, "=" operator subscript, and the condition value "t-home-channel"; [0,3] represents the beginning and ending subscripts of the sphere condition value token, i.e., the beginning and ending subscripts of the "Dingjia ditch bridge" in the question sentence.
"query" records natural language questions; "table_id" represents the ID of the table to which the problem corresponds, and "sql_id" represents the ID of the present data; the "SQL" field represents the logical form of the SQL query to which the question corresponds, where "agg" represents the aggregate operator index to which the query column corresponds; "sel" represents a table data column subscript corresponding to the query column, and "cond_conn_op" represents an operator subscript connecting the where query conditions; "connections" means a list of triples of query conditions, including a where condition column subscript, a where condition operator subscript, a where condition value; "wvi _corenlp" is a conditional value index list that includes a where conditional value token start subscript and a where conditional value token end subscript. "query_tok" is a list of problem token.
According To the method, the problem-SQL pair conforming To Chinese expression is automatically generated through heuristic rules, namely pseudo data (artificial problem-SQL data) can be efficiently and effectively constructed, so that a semantic analysis model can learn the form and the method of a table question-To-SQL task through constructing the pseudo data, the problems that the construction of an existing labeling data set is time-consuming and labor-consuming and depends on domain experts strongly can be solved, and the practical application effect and question-answer accuracy of the table question-answer in the bridge maintenance domain can be further improved.
In the concrete implementation process, in the field of bridge management and maintenance, the main reason of low accuracy of the Text-To-SQL task is that the identification of the where condition is inaccurate, so that the where condition entity and the table column in the problem are difficult To accurately link, and the starting position and the ending position of the where condition value are difficult To accurately position. Therefore, the invention realizes the efficient identification of the domain entities by introducing the knowledge of the bridge management and maintenance domain, and the problem forms are automatically aligned, thereby improving the actual application effect of semantic analysis of the bridge management and maintenance domain.
Referring to industry specifications such as bridge structure division, disease characterization, and technical condition assessment methods, the named entities in the bridge management field are defined as six categories, namely bridge entity (BRI), location entity (POS), bridge structural Entity (ENT), structural element Entity (ENT), structural disease entity (DIS), and time entity (TIM), and specifically shown in table 2.
Table 2 named entity types in bridge management and maintenance field and examples thereof
Figure BDA0004156277290000091
And when the coding problem is solved, the domain entity is automatically identified by the bridge management domain naming entity identification method, so that the accurate positioning of the starting and ending positions of the entity is realized. Aiming at the problem of linking the conditional entity and the table column, the invention realizes accurate mode linking by introducing a knowledge triplet as a domain knowledge guiding model. With reference to fig. 3, the injection of the entity relationship knowledge in the bridge cultivation field is realized through the following steps:
s201: original input problem text Q= { Q based on knowledge graph recognition in bridge management and maintenance field 1 ,q 2 ,q 3 ,…,q n Domain entity e= { E in } 1 ,e 2 ,…,e m Dividing sentences by taking each domain entity as a breakpoint;
s202: searching the bridge management and maintenance domain knowledge graph according to the identified domain entity E to obtain a corresponding domain knowledge triplet set K= { K 1 ,k 2 ,…,k p },k=(e i ,r,e j ) R represents a connection entity e i And e j A relationship between;
s203: the first t triples are filtered through sorting and are combined into domain knowledge to be injected, and the triples k are converted into logic knowledge short sentences w to adapt to sentence coding modes of the problem text Q;
s204: entity e in question text Q i And splicing the corresponding knowledge phrases w to realize the injection of the entity relationship knowledge in the bridge management and maintenance field.
In this embodiment, the knowledge graph of the bridge management and maintenance domain is composed of a set of entity nodes and a set of entity relationship edges, wherein the edges connect two nodes to represent a triplet knowledge, and the triplet knowledge is used for performing the graph representation on the fact information of the bridge management and maintenance domain in the form of "entity-relationship-entity" or "entity-attribute value". The entity refers to a specific bridge name, bridge member name, sensor, disease location, etc. The relation is a semantic relation between two entities and is an example of a relation defined by a knowledge graph semantic model layer in the bridge management and maintenance field. The attribute is a specific description of the entity, and is a mapping relationship between the entity and the attribute value. The method is constructed through three steps of information extraction, knowledge fusion and knowledge processing.
And searching the bridge management and maintenance domain knowledge graph, namely searching the identified entity from the bridge management and maintenance domain knowledge graph, and obtaining a triplet set in the knowledge graph.
The applicant finds that in the field of bridge management, the main reason for low accuracy of the Text-To-SQL task is that the recognition of the where condition is inaccurate, it is difficult To accurately link the where condition entity and the table column in the problem, and it is difficult To accurately locate the start and end positions of the where condition value. Therefore, the training sample is generated by injecting the domain entity relation knowledge into the problem text of the problem-SQL pair, so that the semantic analysis model trained by the training sample can accurately identify the language table and domain vocabulary in the bridge management and maintenance domain, further realize automatic alignment of the problems and tables in the bridge management and maintenance domain and guide the accurate linking of the problem modes, and further improve the accuracy of questions and answers in the bridge management and maintenance domain and the practical application effect.
If the field entity relation knowledge is not injected, the semantic analysis model has poor effect under the task of asking and answering a few sample tables in the bridge management field. Meanwhile, the training corpus in the pre-training stage is mostly general field corpus, semantic gap exists between the training corpus and specific tasks in specific fields, and in the bridge management field, the problems of inconsistent representation of key information in user question sentences, database names and column name information, implicit semantics caused by spoken expression of question sentences and short in field are existed. In addition, because the expression of the question under the Chinese context is more flexible and changeable, the semantic information is rich, and the understanding of the question is more difficult.
In the implementation process, the semantic analysis model is a Chinese form pre-training model SDCUP.
In this embodiment, the semantic parsing model SDCUP aims to solve the problem of alignment of explicit interactive relations between the problem text and the database tables, i.e. the problem of pattern linking. The schema linking problem is to link specific words in the natural language problem to specific columns in the database and give specific dependency of the link in the SQL sentence. For example, the rating time column of the table corresponding to 2020 in the question of fig. 2 is dependent on the type WHERE-Value.
SDCUP (Semantic Dependency Parsing and Named Entity Recognition for Chinese Understanding Tasks) is a Chinese form pre-training model, and the working principle is as follows:
and (3) data collection: the SDCUP model first collects Chinese text data and form data from various Internet resources.
And (3) data processing: the model carries out preprocessing on text data, including word segmentation, part-of-speech tagging, named entity recognition, dependency syntactic analysis and the like. Processing the table data, including table cell content extraction, header identification, and the like.
Model pre-training: the model is pre-trained using the processed text and form data. The pre-training process takes the idea of multitasking learning while taking into account the different features and structures of text and forms. Specifically, the SDCUP model adopts a transducer model as a basic model, and a multi-layer attention mechanism is added on the basic model for processing text and form data.
Fine tuning of the model: after the pre-training is completed, the model can be finely adjusted according to the specific application scene. For example, in a named entity recognition task, the model takes pre-trained parameters as initial values and then uses annotated named entity data for supervised learning.
Model application: after fine tuning is completed, the model can be applied to various Chinese understanding tasks, such as named entity recognition, relation extraction, sentence classification and the like. On the form data, the model can complete the tasks of form semantic analysis, form question-answering and the like.
The semantic analysis model (SDCUP) adopts the thought of multi-task learning, and simultaneously considers different characteristics and structures of the problem text and the form, so that the semantic analysis model has good prediction performance and generalization capability. Specifically, the semantic analysis model predicts the mode dependency relationship (including directed edges and specific dependencies thereof) between the problem text and the database table through the dual affine network, and the whole flow is as follows:
Figure BDA0004156277290000111
Figure BDA0004156277290000112
Figure BDA0004156277290000113
Figure BDA0004156277290000114
Figure BDA0004156277290000115
Figure BDA0004156277290000116
Figure BDA0004156277290000117
Figure BDA0004156277290000118
Figure BDA0004156277290000119
wherein: c j Representing the table columns of a database, c is calculated by a single layer feed forward network j The table columns of the directed edge representation database point to directed edges where a problem token may exist and serve as a means to help the model find the specific columns involved in the problem; q i For a problem token, a representation thereof is similarly computed;
Figure BDA00041562772900001110
representing predicted directed edges q i <-c j Whether or not there is a directed edge q i <-c j Representing slave table column c j Direction problem token i Such as the "rating time" column in fig. 2 points to the "2020" edge of the question; />
Figure BDA00041562772900001111
The best label for predicting each directed edge is represented, the best label represents the specific dependency type of the problem text and the table column link, such as 'WHERE-Value', 'SELECT-part' in figure 2, and the best label is used as a mode for helping a model understand the interaction of the problem and the table column, so that SQL can be generated subsequently; biaff (·) represents a dual affine attention mechanism; />
Figure BDA00041562772900001112
Representation c j Table columns as patternsRelying on directional edge starting points; FFN (FFN) edge-head (c j ) Representing the computation of c over a single layer feed forward network j The table columns are used as the starting points of the mode dependent directed edges;
Figure BDA00041562772900001113
representing prediction c j The table column pattern depends on the specific label; FFN (FFN) label-head (c j ) Representing the computation of c over a single layer feed forward network j The table column pattern depends on the specific label; />
Figure BDA00041562772900001114
Represents q i the token is used as a mode dependent directed edge endpoint; FFN (FFN) edge-dep (q i ) Representing the computation of q through a single layer feed forward network i the token is used as a mode dependent directed edge endpoint; />
Figure BDA00041562772900001115
Representing prediction q i token mode relies on specific tags; FFN (FFN) label-dep (q i ) Representing the computation of q through a single layer feed forward network i token mode relies on specific tags; />
Figure BDA00041562772900001116
Representing calculation of problem token by Biaff (& gt) i And table column c j Directed edge connection between the two;
Figure BDA00041562772900001117
representing calculation of problem token by Biaff (& gt) i And table column c j Directed edge dependency labels between; u, W, b are all learnable parameters.
Specifically, a directed edge refers to a directed edge that connects two nodes in a directed graph, and is directional, i.e., starting from one node, it can only reach the other node in a specific direction. For example, assuming there are two nodes A and B, if the edge from node A points to node B, then the edge is a directed edge. In which case node a points to node B, or node B is a successor to node a. Opposite to the directed edge is a non-directed edge that connects two nodes without directionality, i.e., starting from either node, the other can be reached.
According to the semantic analysis model, through the mode dependency relationship (including directed edges and specific dependencies) between the double affine network prediction problem text and the database table, the interactive relationship between the language problem text and the table column can be automatically inferred through the mode dependency directed edges, so that the actual application effect and the question and answer accuracy of the table question and answer in the bridge management and maintenance field can be further improved.
In the implementation process, the loss function of the semantic analysis model is as follows:
Figure BDA0004156277290000121
wherein: l represents a loss value trained by a semantic analysis model, a directed edge and a corresponding label type thereof are calculated through a cross entropy loss function, the label type is a specific dependency type of a problem text and a table column link, the directed edge and the corresponding label thereof are trained to find an interactive relation between a natural language problem and the table column, and help the model to locate the column mentioned by the problem and a mentioned mode thereof so as to generate a corresponding SQL sentence later; cross EntropyLoss represents the cross entropy loss function;
Figure BDA0004156277290000122
representing predicted directed edges q i <-c j Whether or not it is present; />
Figure BDA0004156277290000123
Representing the best label for predicting each directed edge; />
Figure BDA0004156277290000124
Figure BDA0004156277290000125
Representing true directed edges and specific dependency type labels, which are pre-definedThe training model is automatically constructed by a heuristic method.
According to the invention, the parameters of the semantic analysis model are optimized through the loss function, the loss function can calculate the difference between the directed edge predicted by the model and the corresponding label type thereof and the real directed edge and the corresponding label type thereof, and further the capability of solving the mode linking problem of the model is improved through minimizing the cross entropy loss function, so that the semantic analysis accuracy and performance of the semantic analysis model can be improved. Meanwhile, labels depending on specific modes when the modes of the semantic analysis model are trained to link targets are constructed by the model through rules and trigger functions during training.
In the specific implementation process, with the rising of a pre-training model-fine tuning paradigm, the performance of each task in the natural language processing field is greatly improved. In recent years, a new paradigm of pre-training-sample-prediction has become a post-harvest feature in the field of natural language processing, especially in a few sample scenario. In this example, rather than adapting the pre-trained language model to the downstream task via target engineering, the downstream task is reformulated with the help of text hints to look more like the task solved during the original language model training.
Fine-tuning strategies refer to the techniques and methods to be employed during fine-tuning to maximize the performance of the model on a particular task. The following fine tuning strategy may also be employed in the present invention:
appropriate learning rate: during fine tuning, an appropriate learning rate needs to be set according to the size and difficulty of the data set in order to be able to obtain optimal performance on the data set while keeping the model stable.
Data enhancement: data enhancement can increase the diversity of the data, thereby improving the robustness of the model. For example, in a text classification task, a method of randomly masking or replacing words may be used, and in an image classification task, a method of rotating, flipping, or scaling an image may be used.
Fine tuning layer: for a pre-trained model, the last few layers will generally be referred to as classifier layers. During trimming, the previous layers may be frozen and only the last layers trimmed to better adapt the model to the particular task.
Batch normalization: batch normalization is an optimization technique that can speed up model training and improve its performance. During fine tuning, batch normalization may be used to accelerate the convergence of the model.
Early stop: early stopping is a technique to avoid model overfitting. Early stops can be used during the trimming to prevent over-fitting of the model on the validation set and to improve the generalization performance of the model.
In practice, the choice of the fine-tuning strategy depends on the size and characteristics of the dataset, as well as the structure and training objectives of the model.
According to the invention, the semantic analysis model is subjected to model fine adjustment by designing the template coding problem and the mode information of the template.
In this embodiment, the prompt trimming policy means that p= { P will be 1 ,p 2 ,p 3 ,…,p k The input sequence e (u) = (e (u) 1 ),e(u 2 ),…,e(u n ) Before the pre-training model with parameters theta is input together. During the trimming of the promt, the trimming of the promt embedding (p 1 ,p 2 ,p 3 ,…,p k ) The language model parameter theta and the pre-training word are kept embedded and fixed.
According to the invention, the semantic analysis model is subjected to model fine adjustment by designing the template coding problem and the mode information, so that the application effect of the form question and answer in a few sample scene can be improved, the intelligent retrieval, knowledge reasoning and information fusion capabilities of the semantic analysis model in the few sample scene can be improved, namely the accuracy of the bridge management and maintenance form question and answer can be effectively improved under the conditions of few samples and low resources, and the actual application effect and question and answer accuracy of the form question and answer in the bridge management and maintenance field can be further improved.
Finally, it should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the technical solution, and those skilled in the art should understand that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the present invention, and all such modifications and equivalents are included in the scope of the claims.

Claims (8)

1. The few-sample form question-answering method for the bridge management and maintenance field is characterized by comprising the following steps of:
s1: constructing a question-SQL pair comprising a question text and an SQL query statement as a training sample, and marking;
s2: injecting entity relation knowledge in the bridge management and maintenance field into the problem text of the training sample;
s3: establishing a semantic analysis model which is input as a problem text and output as an SQL query statement, and pre-training the semantic analysis model through a training sample with labels;
s4: performing model fine adjustment on the pre-trained semantic analysis model to obtain a final semantic analysis model;
s5: and outputting SQL query sentences based on the given problem text through a final semantic analysis model to realize question answering.
2. The bridge-oriented field of maintenance few-sample form question-answering method of claim 1, wherein the method comprises the steps of: in step S1, a question-SQL pair conforming to Chinese expression is automatically generated through heuristic rules.
3. The method for inquiring and answering a few-sample table for the bridge management and maintenance field according to claim 1, wherein in step S2, the method for injecting the knowledge of the entity relationship in the bridge management and maintenance field is realized by the following steps:
s201: original input problem text Q= { Q based on knowledge graph recognition in bridge management and maintenance field 1 ,q 2 ,q 3 ,…,q n Domain entity e= { E in } 1 ,e 2 ,…,e m Dividing sentences by taking each domain entity as a breakpoint;
s202: searching the bridge management and maintenance domain knowledge graph according to the identified domain entity E to obtain a corresponding domain knowledge triplet set K= { K 1 ,k 2 ,…,k p },k=(e i ,r,e j ) R represents a connectionEntity e i And e j A relationship between;
s203: the first t triples are filtered through sorting and are combined into domain knowledge to be injected, and the triples k are converted into logic knowledge short sentences w to adapt to sentence coding modes of the problem text Q;
s204: entity e in question text Q i And splicing the corresponding knowledge phrases w to realize the injection of the entity relationship knowledge in the bridge management and maintenance field.
4. The bridge-oriented field of maintenance few-sample form question-answering method of claim 1, wherein the method comprises the steps of: in step S3, the semantic analysis model is a chinese form pre-training model SDCUP, which aims to solve the problem of alignment of explicit interactive relations between the problem text and the database form, i.e. the problem of pattern linking.
5. The bridge management and maintenance-oriented few-sample form question-answering method according to claim 4, wherein the semantic analysis model predicts the mode dependency relationship between the question text and the database form through a dual affine network;
the formula is described as follows:
Figure FDA0004156277270000011
Figure FDA0004156277270000012
Figure FDA0004156277270000013
Figure FDA0004156277270000014
Figure FDA0004156277270000021
Figure FDA0004156277270000022
Figure FDA0004156277270000023
Figure FDA0004156277270000024
Figure FDA0004156277270000025
wherein: c j A table column representing a database; q i Is a question token;
Figure FDA0004156277270000026
representing predicted directed edges q i <-c j Whether or not it is present; />
Figure FDA0004156277270000027
Representing the best label for predicting each directed edge; biaff (·) represents a dual affine attention mechanism;
Figure FDA0004156277270000028
representation c j The table columns are used as the starting points of the mode dependent directed edges; FFN (FFN) edge-head (c j ) Representing the computation of c over a single layer feed forward network j The table columns are used as the starting points of the mode dependent directed edges; FFN (FFN) label-hea (c j ) Representing the computation of c over a single layer feed forward network j The table column pattern depends on the specific label; />
Figure FDA0004156277270000029
Representing prediction c j The table column pattern depends on the specific label; FFN (FFN) edge-dep (q i ) Representing computation of token q through a single layer feed forward network i As a pattern dependent directed edge endpoint; FFN (FFN) label-dep (q i ) Representing computation of token q through a single layer feed forward network i Mode dependent specific tags; />
Figure FDA00041562772700000210
Representing token q i As a pattern dependent directed edge endpoint; />
Figure FDA00041562772700000211
Representing a predicted token i Mode dependent specific tags; />
Figure FDA00041562772700000212
Representing calculation of problem token by Biaff (& gt) i And table column c j Directed edge connection between the two; />
Figure FDA00041562772700000213
Representing calculation of problem token by Biaff (& gt) i And table column c j Directed edge dependency labels between; u, W, b are all learnable parameters.
6. The bridge-oriented field of maintenance few-sample form question-answering method according to claim 4, wherein the loss function of the semantic parsing model is as follows:
Figure FDA00041562772700000214
wherein: l represents a loss value of semantic analysis model training; cross EntropyLoss represents the cross entropy loss function;
Figure FDA00041562772700000215
representing the best label for predicting each directed edge; />
Figure FDA00041562772700000216
Representing predicted directed edges q i <-c j Whether or not it is present;
Figure FDA00041562772700000217
representing the true directed edges and specific dependency type labels.
7. The bridge-oriented field of maintenance few-sample form question-answering method of claim 1, wherein the method comprises the steps of: in step S4, model fine adjustment is carried out on the semantic analysis model through designing the template coding problem and the mode information of the template.
8. The bridge-oriented field of maintenance few-sample form question-answering method of claim 1, wherein the method comprises the steps of: in step S5, the given question text is input into the final semantic analysis model, the corresponding SQL query statement is output, and then the corresponding SQL query statement is executed in the SQL engine, so as to obtain the answer of the given question text.
CN202310335356.XA 2023-03-29 2023-03-29 Few-sample form question-answering method oriented to bridge management and maintenance field Pending CN116303971A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310335356.XA CN116303971A (en) 2023-03-29 2023-03-29 Few-sample form question-answering method oriented to bridge management and maintenance field

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310335356.XA CN116303971A (en) 2023-03-29 2023-03-29 Few-sample form question-answering method oriented to bridge management and maintenance field

Publications (1)

Publication Number Publication Date
CN116303971A true CN116303971A (en) 2023-06-23

Family

ID=86795887

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310335356.XA Pending CN116303971A (en) 2023-03-29 2023-03-29 Few-sample form question-answering method oriented to bridge management and maintenance field

Country Status (1)

Country Link
CN (1) CN116303971A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541943A (en) * 2023-07-06 2023-08-04 清华大学 Intelligent interactive building structure design method, device, platform and electronic equipment
CN116610791A (en) * 2023-07-20 2023-08-18 中国人民解放军国防科技大学 Semantic analysis-based question answering method, system and equipment for structured information
CN116821696A (en) * 2023-08-30 2023-09-29 腾讯科技(深圳)有限公司 Training method, device, equipment and storage medium for form question-answer model
CN117390169A (en) * 2023-12-11 2024-01-12 季华实验室 Form data question-answering method, device, equipment and storage medium
CN117972070A (en) * 2024-04-01 2024-05-03 中国电子科技集团公司第十五研究所 Large model form question-answering method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541943A (en) * 2023-07-06 2023-08-04 清华大学 Intelligent interactive building structure design method, device, platform and electronic equipment
CN116610791A (en) * 2023-07-20 2023-08-18 中国人民解放军国防科技大学 Semantic analysis-based question answering method, system and equipment for structured information
CN116610791B (en) * 2023-07-20 2023-09-29 中国人民解放军国防科技大学 Semantic analysis-based question answering method, system and equipment for structured information
CN116821696A (en) * 2023-08-30 2023-09-29 腾讯科技(深圳)有限公司 Training method, device, equipment and storage medium for form question-answer model
CN116821696B (en) * 2023-08-30 2023-11-24 腾讯科技(深圳)有限公司 Training method, device, equipment and storage medium for form question-answer model
CN117390169A (en) * 2023-12-11 2024-01-12 季华实验室 Form data question-answering method, device, equipment and storage medium
CN117390169B (en) * 2023-12-11 2024-04-12 季华实验室 Form data question-answering method, device, equipment and storage medium
CN117972070A (en) * 2024-04-01 2024-05-03 中国电子科技集团公司第十五研究所 Large model form question-answering method

Similar Documents

Publication Publication Date Title
CN116303971A (en) Few-sample form question-answering method oriented to bridge management and maintenance field
He et al. See: Syntax-aware entity embedding for neural relation extraction
CN116628172A (en) Dialogue method for multi-strategy fusion in government service field based on knowledge graph
Qin et al. A survey on text-to-sql parsing: Concepts, methods, and future directions
CN112528034B (en) Knowledge distillation-based entity relationship extraction method
CN113806563B (en) Architect knowledge graph construction method for multi-source heterogeneous building humanistic historical material
CN110765277B (en) Knowledge-graph-based mobile terminal online equipment fault diagnosis method
CN112380325A (en) Knowledge graph question-answering system based on joint knowledge embedded model and fact memory network
CN112766507B (en) Complex problem knowledge base question-answering method based on embedded and candidate sub-graph pruning
US20240143644A1 (en) Event detection
Wu et al. A novel community answer matching approach based on phrase fusion heterogeneous information network
CN114003709A (en) Intelligent question-answering system and method based on question matching
Miao et al. A dynamic financial knowledge graph based on reinforcement learning and transfer learning
Qin et al. Agriculture knowledge graph construction and application
CN111666374A (en) Method for integrating additional knowledge information into deep language model
CN117454884B (en) Method, system, electronic device and storage medium for correcting historical character information
Kung et al. Intelligent pig‐raising knowledge question‐answering system based on neural network schemes
CN117194616A (en) Knowledge query method and device for vertical domain knowledge graph, computer equipment and storage medium
CN116258204A (en) Industrial safety production violation punishment management method and system based on knowledge graph
CN115617954A (en) Question answering method and device, electronic equipment and storage medium
CN115238705A (en) Semantic analysis result reordering method and system
CN114003773A (en) Dialogue tracking method based on self-construction multi-scene
Chen et al. An Efficient ROS Package Searching Approach Powered By Knowledge Graph.
Fan et al. An integrated interactive framework for natural language to sql translation
Li et al. Deep learning for semantic matching: A survey

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