Nothing Special   »   [go: up one dir, main page]

CN113157880B - Element content obtaining method, device, equipment and storage medium - Google Patents

Element content obtaining method, device, equipment and storage medium Download PDF

Info

Publication number
CN113157880B
CN113157880B CN202110319845.7A CN202110319845A CN113157880B CN 113157880 B CN113157880 B CN 113157880B CN 202110319845 A CN202110319845 A CN 202110319845A CN 113157880 B CN113157880 B CN 113157880B
Authority
CN
China
Prior art keywords
target
sample
content
case text
coding
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
CN202110319845.7A
Other languages
Chinese (zh)
Other versions
CN113157880A (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.)
iFlytek Co Ltd
Original Assignee
iFlytek 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 iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN202110319845.7A priority Critical patent/CN113157880B/en
Publication of CN113157880A publication Critical patent/CN113157880A/en
Application granted granted Critical
Publication of CN113157880B publication Critical patent/CN113157880B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/38Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/383Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/18Legal services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • General Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Library & Information Science (AREA)
  • Tourism & Hospitality (AREA)
  • Mathematical Physics (AREA)
  • General Business, Economics & Management (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Economics (AREA)
  • Technology Law (AREA)
  • Marketing (AREA)
  • Human Computer Interaction (AREA)
  • Human Resources & Organizations (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device, equipment and a storage medium for acquiring element content, wherein the method comprises the following steps: acquiring a target case text; determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text; and acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element. The element content obtaining method can automatically determine the target elements according to the target case text, and can automatically determine the element content corresponding to the target elements according to the target case text and the element representation vectors corresponding to the target elements.

Description

Element content obtaining method, device, equipment and storage medium
Technical Field
The present application relates to the field of natural language processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for acquiring element content.
Background
In the judicial field, for officers, inspection officers and other staff working at the front of the public inspection and legal lines, a large number of legal documents cannot be opened in any one stage of case handling, and in order to facilitate the officers, the inspection officers and other staff to quickly know cases, the element contents corresponding to the elements are often required to be acquired according to the legal documents.
Most of the existing element content acquisition modes are manual acquisition modes, namely manually acquiring element contents corresponding to elements by reading legal documents. However, the manual acquisition method is time-consuming and labor-consuming, that is, the manual cost and the time cost of the manual acquisition method are high, and the manual acquisition method is easily affected by subjective factors, which may cause that the acquired element content may be inaccurate.
Disclosure of Invention
In view of the above, the present application provides a method, an apparatus, a device and a computer-readable storage medium for acquiring element content, so as to solve the problems that the labor cost and the time cost of the existing element content acquisition method are high, and the acquisition of the element content is easily affected by subjective factors, and the technical scheme is as follows:
an element content acquisition method, comprising:
acquiring a target case text;
determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text;
and acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
Optionally, the element representation vector corresponding to the target element is further used for representing semantics of the target element and a relationship between the target element and the target case text.
Optionally, the determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element includes:
determining a target element based on the target case text and a pre-trained element coding model;
determining an element representation vector corresponding to the target element based on the target element, the target case text and the element coding model;
the element coding model is obtained by training a first sample containing case text, elements and element content, the elements in the first sample correspond to real problems, the answer of the problems is the element content in the first sample, and the training target of the element coding model is the problem predicted according to the element representation vector output by the element coding module and tends to the real problems corresponding to the elements in the first sample.
Optionally, the element content corresponding to the target element is one or more of the following:
the target case text comprises a text segment which describes the target element, indication information which indicates that the target element is not mentioned by the target case text, indication information which indicates that the situation described by the target element in the target case text is true, and indication information which indicates that the situation described by the target element in the target case text is not true.
Optionally, the obtaining of the element content corresponding to the target element based on the target case situation text and the element representation vector corresponding to the target element includes:
acquiring element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element and a pre-trained element content extraction model;
the element content extraction model is obtained by training a second sample containing case text and element representation vectors and real element content corresponding to elements represented by the element representation vectors in the second sample, and the element representation vectors in the second sample are obtained based on the case text in the second sample and the element coding model.
Optionally, parameters of the element content extraction model are initialized according to a pre-trained reading understanding model;
the reading understanding model is obtained by training a third sample containing the case text and the question and the answer of the question in the third sample, and the question in the third sample is converted according to the elements related to the case text in the third sample.
Optionally, the obtaining of the element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element, and a pre-trained element content extraction model includes:
target data is composed of the target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to the target elements, wherein the first answer identifiers, the second answer identifiers, the third answer identifiers and the element type identifiers corresponding to the target elements are sequentially used for indicating: the target element is not mentioned by the target case text, the situation of the target element described in the target case text is true, the situation of the target element described in the target case text is not true, and the element type corresponding to the target element;
and extracting element content corresponding to the target element from the target data based on the target data and the element content extraction model.
Optionally, the extracting, based on the target data and the element content extraction model, element content corresponding to the target element from the target data includes:
determining position indication information corresponding to the target element based on the target data and the element content extraction model, wherein the position indication information is used for indicating the position of element content corresponding to the target element in the target data;
and extracting element content corresponding to the target element from the target data based on the position indication information corresponding to the target element.
Optionally, the determining, based on the target data and the element content extraction model, position indication information corresponding to the target element includes:
and inputting the target data into the element content extraction model, coding the target case text by combining the element content extraction model with the element expression vector in the target data, and determining the position indication information corresponding to the target element according to the case expression vector which is obtained by coding and is fused with the element information.
Optionally, the target elements are one or more;
if the target elements are multiple, the target data comprise target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to each target element; the element content extraction model outputs position indication information corresponding to a plurality of target elements respectively, and the position indication information comprises: the corresponding target element, the position indication information of the initial character and the position indication information of the end character in the element content corresponding to the corresponding target element.
Optionally, the training process of the element coding model includes:
inputting the first sample into an element coding model to obtain an element representation vector corresponding to an element in the first sample output by the element coding model;
determining a prediction probability of a problem corresponding to an element in the first sample based on a problem decoder, an element representation vector corresponding to an element in the first sample, and a problem corresponding to an element in the first sample;
and updating the parameters of the element coding model according to the prediction probability of the problem corresponding to the element in the first sample.
Optionally, the inputting the first sample into an element coding model to obtain an element representation vector corresponding to an element in the first sample output by the element coding model includes:
inputting the elements in the first sample into an element coding module of an element coding model for coding to obtain an element coding result;
inputting the case text in the first sample into a case coding module of the element coding model for coding to obtain a case coding result;
inputting the element content in the first sample into an element content coding module of an element coding model for coding to obtain an element content coding result;
inputting the case coding result and the element content coding result into a data fusion module of an element coding model for fusion to obtain a fusion result;
inputting the case coding result and the fusion result into a data splicing module of the element coding model for splicing to obtain a splicing result;
and inputting the splicing result into an element representation vector determining module of an element coding model to obtain an element representation vector corresponding to the element in the first sample.
Optionally, the training process of the element content extraction model includes:
inputting the second sample into an element content extraction model to obtain element content predicted for elements represented by element representation vectors in the second sample;
determining the prediction loss of the element content extraction model according to the predicted element content and the real element content corresponding to the elements in the second sample;
and updating parameters of the element content extraction model according to the determined prediction loss.
Optionally, the method for acquiring element content further includes:
determining a prediction probability of a problem corresponding to an element represented by the element representation vector in the second sample based on a problem decoder and the problem corresponding to the element represented by the element representation vector in the second sample;
and optimizing the parameters of the element coding model according to the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample.
An element content acquiring apparatus comprising: the system comprises a case text acquisition module, a factor representation vector determination module and a factor content acquisition module;
the case text acquisition module is used for acquiring a target case text;
the element representation vector determining module is used for determining a target element based on the target case text and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text;
and the element content acquisition module is used for acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
An elemental content acquiring apparatus comprising: a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program to implement the steps of the element content acquiring method according to any one of the above-described embodiments.
A computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the respective steps of the elemental content acquisition method described in any one of the above.
According to the scheme, the element content obtaining method, the device, the equipment and the storage medium provided by the application are used for firstly obtaining the target case text, then determining the target element based on the target case text, determining the element expression vector capable of representing the semantics of the target element in the target case text based on the target case text and the target element, and finally obtaining the element content corresponding to the target element based on the target case text and the determined element expression vector. The element content acquisition method can automatically determine the elements according to the target case text and automatically determine the element content corresponding to the target elements, saves labor cost, reduces time consumption for acquiring the elements, saves time cost, avoids influence of subjective factors on element content acquisition results, and improves accuracy of element content acquisition.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for acquiring element content according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a process of obtaining element contents corresponding to a target element based on a target case text and an element representation vector corresponding to the target element according to an embodiment of the present application;
FIG. 3 is a schematic flowchart of a process for separately training an element coding model according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an element coding model provided in an embodiment of the present application;
FIG. 5 is a diagram illustrating training using a problem decoder co-factor coding model according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an element content extraction model according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a training process of an element content extraction model according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an element content acquiring apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an element content acquiring device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
In order to achieve the acquisition of the content of the element corresponding to the element, the inventors studied, and the first idea was: the method comprises the steps of defining a series of element labels in advance, inputting case texts into a coding neural network (such as RNN, CNN and the like), learning semantic information of the input case texts by the coding neural network, classifying each word (or character) in the input case texts by combining CRF (learning cycle) with the element labels, and finally obtaining element contents according to the element labels corresponding to each word (or character).
The inventor of the present invention finds, through research, that because an element content acquisition method based on sequence labeling needs to define element labels in advance, and during training and prediction, names of the element labels and the number of the element labels are fixed, which results in that a model obtained through training has no recognition capability on undefined element labels, in practical application, according to policy documents which are delivered at different periods and policy regulations of different regions, examination emphasis of case trial and law application processes is different, which results in that case element content extraction often has a requirement for element label modification, and the method cannot meet the requirement. In addition, the method for acquiring element contents based on sequence labeling has other problems, such as that the element contents cannot be extracted for a large number of elements (one project may include dozens of different elements in an element system), and the accuracy of extracting the element contents is not high.
In view of the defects of the element content acquisition method based on the sequence marking, the inventor tries to adopt the element content acquisition method based on reading understanding to realize the acquisition of the element content corresponding to the element, and the general idea of the element content acquisition method based on reading understanding is to convert an element into a question, input a case situation text and the question into a reading understanding model, extract an answer corresponding to the input question from the case situation text by the reading understanding model, and obtain the answer corresponding to the question as the element content corresponding to the element.
However, the element content acquisition method based on reading understanding needs to convert the element into a problem, and the element content can be extracted only for one element at a time, and the extraction of the element content cannot be realized for the batch of elements.
In addition, the two element content acquisition methods can only extract text segments, that is, only extract text segments describing elements from case texts, and cannot analyze and judge the elements.
In view of the above problems of the method for acquiring element content, the present inventors have continued research and finally proposed a method for acquiring element content with good effect through research, the basic idea of the method is as follows:
determining elements according to the case text, determining an element expression vector capable of representing at least the semantics of the elements in the case text according to the elements and the case text, then taking the element expression vector as an expression vector of a problem corresponding to the elements, and acquiring the element content corresponding to the elements by combining a reading understanding method based on the case text and the element expression vector.
The element content obtaining method provided by the application can be applied to electronic equipment with processing capacity, the electronic equipment can be a server on a network side, and can also be a terminal used by a user side, such as a PC, a notebook, a smart phone and the like, and the server on the network side or the terminal used by the user side can obtain element contents corresponding to elements according to the element content obtaining method provided by the application.
Next, the method for acquiring the content of the element provided by the present application will be described by the following embodiments.
First embodiment
Referring to fig. 1, a schematic flow diagram of a method for acquiring element content according to an embodiment of the present application is shown, where the method may include:
step S101: and acquiring a target case text.
The target case text in this embodiment is a text describing a case.
Step S102: and determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element.
The target elements may be elements in an element system previously sorted out for a case corresponding to the target case situation text (different element systems sorted out for different cases), or may be elements not included in the element system (new elements may appear according to development and innovation regulated by laws and regulations and case treatment). There may be one or more target elements, and if there are more target elements, the element representation vectors corresponding to the target elements can be obtained via step S102.
If viewed from the text content, the target elements in the present embodiment may be, but are not limited to, one or more of the following elements: time class elements (e.g., case occurrence time, reception time, etc.), place class elements, person class elements (e.g., original notice, third party, guarantor, etc.), action event class elements (e.g., xx actions by xx means), and the like; the target element in the present embodiment may be, but is not limited to, one or more of the following elements if viewed from the element extraction type: segment class elements (text segments describing elements), whether class elements (whether the element is true), whether class elements are mentioned (whether elements are mentioned in case text), etc.
In this embodiment, the element representation vector corresponding to the target element is at least used for representing the semantic meaning of the target element in the target case text, and preferably, the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element, the semantic meaning of the target element in the target case text, and the relationship between the target element and the target case text.
It should be noted that the relationship between the target element and the target case text may include one or more of the following relationships: the position of the target element appearing in the target case text (for example, after some facts are described in the case text, the element a needs to be mentioned), the co-occurrence or mutual exclusion relationship of different target elements in the target case text (for example, the element B must appear or not appear according to the fact described by the element a), the relative position of the co-occurrence target elements in the target case text (for example, the element a usually appears before the element B), and the like.
In this embodiment, the process of determining the target element based on the target case text and determining the element representation vector corresponding to the target element based on the target case text and the target element may include: and determining a target element based on the target case text and a pre-trained element coding model, and determining an element representation vector corresponding to the target element based on the target element, the target case text and the element coding model.
Specifically, the target case text is input into a pre-trained element coding model, the element coding model determines a target element according to the target case text, and then an element representation vector corresponding to the target element is determined according to the target element and the target case text.
The element coding model is obtained by training a first sample containing case texts, elements and element contents. It should be noted that the element in the first sample is an element related to the case text in the first sample, the element in the first sample is one element, the content of the element in the first sample is the content of the element corresponding to the element in the first sample, the element in the first sample corresponds to a real question (where "real question" is relative to the subsequently-mentioned predicted question), the real question corresponding to the element in the first sample is converted according to the corresponding element, and the answer to the question corresponding to the element in the first sample is the content of the element in the first sample. The elements and the element contents in the first sample and the real problems corresponding to the elements in the first sample are marking data.
In the training, the input of the element coding model is a first sample, and the output is an element representation vector corresponding to an element in the first sample, and the training target of the element coding model is to make the problem of element representation vector prediction output by the element coding model approach to the real problem corresponding to the element in the first sample, that is, to make the problem of element prediction approach to the real problem corresponding to the element.
Step S103: and acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
If there are a plurality of target elements, the element contents corresponding to the plurality of target elements can be obtained through step S103, and the present application supports simultaneous extraction of the element contents corresponding to the plurality of elements.
Specifically, the process of obtaining the element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element may include: and acquiring element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element and a pre-trained element content extraction model.
The element content extraction model is obtained by training a second sample containing case text and element representation vectors and real element content corresponding to elements represented by the element representation vectors in the second sample, and it should be noted that the element representation vectors in the second sample are obtained based on the case text and the element coding model in the second sample.
It should be noted that the element content extraction model is essentially a reading understanding model, in this embodiment, the element representation vector corresponding to the target element is used as the question representation vector corresponding to the target element (i.e., the representation vector of the question corresponding to the target element), the case text and the question representation vector corresponding to the target element are input into the element content extraction model, so as to determine the answer to the question corresponding to the target element by using the element content extraction model, and the answer to the question corresponding to the target element is the element content corresponding to the target element. The element content acquiring method provided by the embodiment does not need to acquire the problem corresponding to the target element (i.e. does not need to convert the element into the problem) when acquiring the element content corresponding to the target element.
In this embodiment, the element content corresponding to the target element is one or more of the following: the text segment of the target element is described in the target case text, the indication information that the target element is not mentioned by the target case text, the indication information that the situation described by the target element in the target case text is true, and the indication information that the situation described by the target element in the target case text is not true.
By the element content acquiring method provided by the embodiment, not only can extraction of text segments (namely, text segments describing elements are extracted from case texts) be realized, but also analysis and judgment on the elements can be realized, for example, whether the situation described by the elements in the case is true or not and whether the elements are mentioned by the case or not are judged.
The element content obtaining method provided by the embodiment of the application can automatically determine the target element based on the target case text, and can determine the element expression vector capable of representing the semantics of the target element, the semantics of the target element in the target case text and the relation between the target element and the target case text based on the target case text and the target element, and after the element expression vector is obtained, the element expression vector can be used as a problem expression vector, and the element content corresponding to the target element is determined by adopting a reading understanding method. The element content acquiring method can automatically determine the elements according to the target case text and automatically determine the element content corresponding to the target elements, saves labor cost compared with the existing manual acquiring mode, reduces time consumption for acquiring the elements, saves time cost, avoids influence of subjective factors on element content acquiring results, and improves accuracy of acquiring the element content. In addition, the element content acquisition method provided by the embodiment of the application does not need to convert the elements into problems, can realize extraction of element content for batch elements, and can realize analysis and judgment for the elements besides extraction of text fragments.
Second embodiment
This embodiment is similar to the "step S103: and acquiring the implementation process of the element content corresponding to the target element for introduction based on the target case text and the element representation vector corresponding to the target element.
Referring to fig. 2, a schematic flow chart illustrating obtaining element content corresponding to a target element based on a target case text and an element representation vector corresponding to the target element is shown, and the schematic flow chart may include:
step S201: target data is composed of a target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to target elements.
In order to realize extraction of text fragments and analysis and judgment of elements, the embodiment combines the target case text and the element representation vector, the first answer identifier, the second answer identifier, the third answer identifier, and the element type identifier corresponding to the target element into target data.
The first answer identifier, the second answer identifier, the third answer identifier and the element type identifier corresponding to the target element are used for indicating that: the target element is not mentioned by the target case text, the situation of the target element described in the target case text is true, the situation of the target element described in the target case text is not true, and the element type corresponding to the target element.
It should be noted that the element type corresponding to the target element is one of "yes/no class" and "fragment class". The element content corresponding to the target element of the "whether type" is used for indicating whether the element content corresponding to the target element is referred to by the target case text or not, or whether the situation described by the target element in the target case text is true or not, and the element content corresponding to the target element of the "segment type" is a text segment describing the target element in the target case text.
Step S202: and extracting element content corresponding to the target element from the target data based on the target data and a pre-established element content extraction model.
Specifically, the implementation process of step S202 may include:
step S2021, the target data is input to the element content extraction model, and the position indication information corresponding to the target element output by the element content extraction model is obtained.
Specifically, target data is input into an element content extraction model, the element content extraction model is combined with element representation vectors in the target data to encode a target case text to obtain case representation vectors fused with element information of the target elements, and then position indication information corresponding to the target elements is determined according to the case representation vectors fused with the element information of the target elements.
The position indication information is used for indicating the position of element content corresponding to the target element in the target data.
The above embodiment mentions that the target element may be one or multiple, if the target element is one, the target data includes the target case text, and the element representation vector, the first answer identifier, the second answer identifier, the third answer identifier, and the element type identifier corresponding to the one target element. If the target elements are multiple, the target data comprise target case text, and the element representation vector, the first answer identifier, the second answer identifier, the third answer identifier and the element type identifier corresponding to each element.
When there is one target element, an example of target data of the input element content extraction model is as follows:
x=[[CLS][YES][NO]y f [Q type ][SEP];x c1 ,x c2 ,x c3 ,...,x cN ]
wherein "CLS" is the first answer identifier, "YES" is the second answer identifier, "NO" is the third answer identifier, "y f "is an element representation vector corresponding to a target element," Q type "is an element type corresponding to the target element and takes a value of" YN "(indicating whether or not class) or" VA "(indicating fragment class)", "SEP" is a separator, and "x" is a value of "YN" (indicating whether or not class) or "VA" (indicating fragment class) ", and c1 ,x c2 ,x c3 ,...,x cN "is each character in the target case text.
When the target elements are plural (I is assumed), an example of target data of the input element content extraction model is as follows:
Figure BDA0002992652660000121
in this embodiment, the position indication information corresponding to the target element output by the element content extraction model may include position indication information of the start character and position indication information of the end character in the target element and the element content corresponding to the target element, that is, the element content extraction model outputs one triple (I) for each target element start ,I end ,f i ) Wherein f is i Represents the ith target element, I start Is the ith target element f i Position indication information of the initial character in the corresponding element content, I end Is the ith target element f i And indicating the position of the end character in the corresponding element content.
Optionally, I start May be f i The subscript, I, of the starting character in the corresponding element content in the target data x end Can be f i The end character in the corresponding element content is a subscript in the target data x. In the target data x, "CLS", "YES", "NO", "x", and the like c1 ”、“x c2 ”…“x cN "both have subscripts such as" CLS "with a subscript of" 0"," YES "with a subscript of" 1"," NO "with a subscript of" 2 "in the target data x, if f i If the corresponding element content is "CLS", "YES" or "NO", then f i The subscript of the corresponding element content in the target data x for the start character is the same as the subscript of the corresponding element content in the target data x for the end character, i.e. I start And I end The same is true.
Step S2022 extracts the element content corresponding to the target element from the target data based on the position indication information corresponding to the target element.
The position of the element content corresponding to the target element in the target data can be obtained according to the position indication information corresponding to the target element, so that the target data can be obtainedThe element content corresponding to the target element is extracted. For example, a target element corresponds to I start And I end Similarly, the subscripts of the initial character and the end character in the element content corresponding to the target element are both 1, so that the element content corresponding to the target element is "CLS", and the element content corresponding to the target data is "CLS", which indicates that the target element is not mentioned by the target case text; as another example, a target element corresponds to I start And I end In contrast, according to I start And I end The initial character of the element content corresponding to the target element is known as' x c2 ", the end character is" x c15 "if the element content corresponding to the target element is the text segment" x "in the target case text c2 ,…,x c15 ”。
Third embodiment
As can be seen from the above embodiments, the element content is obtained based on the element coding model trained in advance and the element content extraction model trained in advance, and the present embodiment describes the training process of the element coding model and the element content extraction model.
The present embodiment first describes a training process of the element coding model.
In one possible implementation manner, an "individual training manner" may be adopted to train the element coding model, that is, the element coding model is trained individually; in another possible implementation manner, the element coding model may be trained in an "individual training manner + joint training manner", where the "joint training manner" refers to jointly training the element coding model obtained by the "individual training manner" and the element content extraction model, that is, the element coding model is trained individually, and then the element coding model obtained by the training is trained jointly with the element content extraction model to optimize the element coding model obtained by the individual training.
Referring to fig. 3, a schematic flow chart of training an element coding model separately is shown, which may include: the method comprises the following steps:
step S301 inputs the first sample into the element coding model, and obtains an element representation vector corresponding to an element in the first sample output by the element coding model.
In the above embodiment, the first sample includes case text, elements and element contents, and what is performed in step a1 is to input the case text, the elements and the element contents into the element coding model to obtain the element representation vectors corresponding to the elements in the first sample.
In order to implement the training of the element encoding model and the element content extraction model, this embodiment may construct a training data set in advance, where the training data set includes a plurality of pieces of training data, and each piece of training data may include case text, elements, questions, and element content, where a question in a piece of training data is a question corresponding to an element in the piece of training data, and is converted from an element in the piece of training data, for example, an element is "husband and wife's mutual debt", and a question converted according to the element is "is whether the debt is in the duration of the husband and wife's relationship? ", the content of the element in a piece of training data is the answer to the question in the piece of training data.
When the element coding model is trained, training data can be obtained from a training data set, and case texts, elements and element contents in the obtained training data form a first sample input element coding model.
Referring to fig. 4, a schematic structural diagram of an element coding model is shown, which may include: an element encoding module 401, a case encoding module 402, an element content encoding module 403, a data fusion module 404, a data splicing module 405, and an element representation vector determination module 406.
The process of inputting the first sample into the element coding model shown in fig. 4 to obtain the element representation vector corresponding to the element in the first sample output by the element coding model may include:
in step S3011a, the element in the first sample is input to the element coding module 401 of the element coding model and coded, so as to obtain an element coding result.
If the element in the first sample is denoted x f Is about to bePrime encoding module 401 is denoted g 1 If the element code result is g 1 (x f )。
Step S3011b, the case text in the first sample is input into the case coding module 402 of the element coding model for coding, and a case coding result is obtained.
If the element in the first sample is denoted x c Case encoding module 402 is denoted as g 2 If the case condition coding result is g 2 (x c )。
In step S3011c, the element content in the first sample is input to the element content coding module 403 of the element coding model for coding, and an element content coding result is obtained.
If the element in the first sample is denoted x a The element content encoding module 403 is denoted as g 3 If the element content is encoded as g 3 (x a )。
Step S3012, inputting the case coding result and the element content coding result into the data fusion module 404 of the element coding model for fusion, and obtaining a fusion result.
Specifically, the case information can be encoded as a result g 2 (x c ) And element content encoding result g 3 (x a ) Weighted summation, i.e. fusion result of α g 2 (x c )+(1-α)*g 3 (x a )。
And S3013, inputting the case coding result and the fusion result into the data splicing module 405 of the element coding model for splicing to obtain a splicing result.
Suppose the stitching result is represented as y joint And then:
y joint =concat[g 1 (x f );α*g 2 (x c )+(1-α)*g 3 (x a )] (1)
wherein alpha is the relative weight of the case information and the element content information, the value of alpha is [0,1], in the training stage, the value of alpha is less than 1, namely, the element content information (namely, the specific content of the element in the case description) needs to be integrated, in the testing stage, the value of alpha is 1, namely, the element content information does not need to be integrated.
Step S3014 is to input the splicing result to the element representation vector determination module 406 of the element coding model, and obtain an element representation vector corresponding to the element in the first sample.
Specifically, the element representation vector determination module 406 of the element coding model may be a full connection layer, and the splicing result y joint After the fully connected layer is input, the fully connected layer outputs an element representation vector y corresponding to the element in the first sample f ,y f The expression of (c) is as follows:
y f =g(x f ,x c ,x a )=W f (y joint )+b f (2)
wherein g represents an element coding model, W f And b f The parameters of the vector determination module 406, i.e. the fully-connected layer, are represented for an element.
Step S302, based on the problem decoder, the element representation vector corresponding to the element in the first sample and the problem corresponding to the element in the first sample, the prediction probability of the problem corresponding to the element in the first sample is determined.
As shown in fig. 5, the present embodiment utilizes a problem decoder to assist element coding model training, specifically, an element representation vector (i.e., an element representation vector corresponding to an element in a first sample) output by an element coding model is input to a problem decoder for decoding, and during the decoding process, the prediction probability of each character in the problem corresponding to the element in the first sample is determined, and finally, the prediction probability of the problem corresponding to the element in the first sample is determined according to the prediction probability of each character in the problem corresponding to the element in the first sample.
Specifically, the prediction probability of the problem corresponding to the element in the first sample is determined by the following formula:
Figure BDA0002992652660000161
wherein, y q Decoder for question based on y of input f In the determined first sampleRepresentation vector, y, of the problem to which the element corresponds q =σ(f(y f ) σ is the activation function at the output of the problem decoder, P (y) q |g 1 (x f ),g 2 (x c ),g 3 (x a ) P (y) represents the prediction probability of the problem for the element in the first sample, P (y) qi |y q,1 ,y q,2 ,...,y q,i-1 ,g 1 (x f ),g 2 (x c ),g 3 (x a ) Is) represents the predicted probability of the ith character in the question for the element in the first sample.
Optionally, the element encoding module 401, the case encoding module 402, and the element content encoding module 403 in the element encoding model may be composed of a wide-to-narrow (i.e., pyramid) deep neural network structure, the decoding part f in the problem decoder is composed of a narrow-to-wide (i.e., inverted pyramid) deep neural network structure, and the hidden unit may be transformers or biGRU.
Step S303, updating parameters of the element coding model according to the prediction probability of the problem corresponding to the element in the first sample.
And performing iterative training on the element coding model for multiple times according to the steps S301 to S303 until a training end condition is met.
In the process of training the element coding network according to the process, the element coding network can learn the semantic information of the elements, learn the semantic information of the elements in the case text according to the content of the elements and learn the relationship between the elements and the case text, and after training, the element coding model can output element expression vectors which can represent the semantics of the elements, the semantics of the elements in the case text and the relationship between the elements and the case text.
The above description introduces the process of training the element coding model alone, and the process of performing the joint training on the element coding model obtained by training will be introduced together when the subsequent training process of the element content extraction model is introduced.
Next, a training process of the element content extraction model will be described.
The element content extraction model in this embodiment is obtained by training a second sample (in the above embodiment, the second sample includes a case text and an element representation vector) and real element content corresponding to an element represented by the element representation vector in the second sample.
In a possible implementation manner, as shown in fig. 6, the element content extraction model may include a scenario coding module and an element attention module, and optionally, the scenario coding module may be composed of transforms (a transform unit structure is composed of an FFN layer + norm layer + sum + MHA layer of a small box in the figure).
In this embodiment, a reading understanding model may be trained by using a third sample including the case text and the question and the answer to the question in the third sample, and the case encoding module in the element content extraction model is initialized by using the reading understanding model obtained through training, that is, the parameter of the case encoder module in the initial element content extraction model is determined according to the reading understanding model obtained through training.
Referring to fig. 7, a flow chart of a training process of the element content extraction model is shown, which may include:
step S701 predicts the element content, which is indicated by the element indication vector in the second sample, based on the second sample and the element content extraction model.
Specifically, the implementation process of step S701 may include:
step S7011, target data x' is composed of the case text and the element representation vector in the second sample, and the first answer identifier, the second answer identifier, the third answer identifier, and the element type identifier.
The element representation vector in the second sample may be an element representation vector corresponding to one element, or may be an element matrix composed of element representation vectors corresponding to a plurality of elements, and the form of the element matrix is as follows:
Figure BDA0002992652660000171
wherein, I represents the ith element, I represents the total number of elements, and J +1 represents the dimension of the vector for each element, that is, the above-mentioned element matrix is the vector matrix with dimension I x J + 1.
It should be noted that the elements represented by the element representation vector in the second sample are all elements related to the case text in the second sample.
Step S7012 is to input the element content extraction model to the target data x' obtained in step S7011, and obtain position indication information corresponding to the element represented by the element representation vector in the second sample output by the element content extraction model.
Specifically, the target data x' is input into an element content extraction model, the element content extraction model combines the element representation vector in the second sample to encode the case text in the second sample to obtain the case representation vector integrated with the element information, and then the position indication information corresponding to the element represented by the element representation vector in the second sample is determined according to the case representation vector integrated with the element information.
In the above, the element content extraction model includes a case coding module and an element attention module, after the target data is obtained, the target data is input into the case coding module for coding, the case coding module outputs a case representation vector integrated with the element information, if the case coding module is represented as Φ, after the target data x' obtained in step S7011 is input into the case coding module, the case representation vector c integrated with the element information output by the case coding module can be represented as:
Figure BDA0002992652660000182
wherein d is Φ Is the dimension of the vector output by the case encoding module, and I is the number of element representation vectors (i.e. the number of elements whose element contents are to be determined) in the target data x'.
In addition, c is defined by c 1 ~c I Composition of c 1 To merge into a first elementThe case of the element information of (a) represents a vector I The case representation vector with the element information of the I-th element is obtained, then the case representation vector c with the element information is input into an element attention module (the element attention module is used for determining which element in a plurality of elements the extracted element content belongs to when extracting the element content corresponding to the elements), the element attention module determines the weight corresponding to the I elements according to the c, and then the c is subjected to the weight corresponding to the I elements 1 ~c I Weighted summation is carried out to obtain a vector u after weighted summation d Finally according to u d And determining position indication information corresponding to the elements represented by the element representation vectors in the second sample.
Wherein, the weights corresponding to the I elements can be determined according to the following formula:
u i =σ(W c c i +b c ) (5)
Figure BDA0002992652660000181
where σ denotes the activation function (common tanh function), u c The context vector used to calculate the weights is the vector learned by the model.
In obtaining alpha i Then, u can be determined according to the following formula d
u d =∑ i α i c i (7)
Step S7013 is to obtain, from the target data x', the element content predicted for the element represented by the element representation vector in the second sample, based on the position indication information output by the element content extraction model.
The position indication information output by the element content extraction model may be a triplet including an element, a prediction index of the start character of the element content corresponding to the element in the target data x ', and a prediction index of the end character of the element content corresponding to the element in the target data x'.
Step S702: the predicted loss of the element content extraction model is calculated based on the predicted element content and the actual element content corresponding to the element represented by the element representation vector in the second sample.
Specifically, the predicted loss of the element content extraction model may be determined based on the following equation:
L=L start +L end =CE(p start ,Y start )+CE(p end ,Y end ) (8)
wherein p is start A predicted index, p, of the starting character of the element content end A predicted index of the end character of the element content, Y start True subscript, Y, of the element content starting character end CE represents cross-entropy, i.e. cross-entropy loss, p, as a true subscript to the end character of the element content start Predicting probability P according to subscript of initial character of element content start Determination of p end Predicting probability P according to subscript of ending character of element content end Determining, for the starting character, the index prediction probability P start And subscript predicted probability of ending character P end Is determined by the following formula:
Figure BDA0002992652660000191
wherein O is case expression vector which is output by case coding module and is fused with element information, W start And W end Are model parameters.
Step S703: and updating the parameters of the element content extraction model according to the predicted loss of the element content extraction model.
And performing iterative training on the element content extraction model for multiple times according to the steps S601 to S603 until a training ending condition is met.
In order to further optimize the element coding model obtained by training in the "individual training mode", the embodiment may perform joint training on the element coding model obtained by training in the "individual training mode" and the element content extraction model, specifically:
the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample is determined based on the problem decoder, the element representation vector in the second sample, and the true problem corresponding to the element represented by the element representation vector in the second sample, and the parameter of the element coding model is optimized according to the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample. The prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample is as follows:
Figure BDA0002992652660000201
wherein Θ represents a parameter of the element encoding model, y q,i The element in the second sample represents the ith character in the question corresponding to the element represented by the vector.
Optionally, an element training signal flagtrain may be introduced, where the flagtrain is used to indicate whether to optimize an element coding model obtained by training in an "individual training mode", and a value of the flagtrain may be set manually, for example, the value of the flagtrain may be set to "True" or "False", and if the value of the flagtrain is "True", the element coding model is optimized, and if the value of the flagtrain is "False", the element coding model is not optimized.
Fourth embodiment
After the element coding model and the element content extraction model are obtained by training according to the training mode provided by the embodiment, the element content extraction can be carried out on the target case text based on the element coding model and the element content extraction model obtained by training.
Specifically, the element coding model obtained by inputting and training the target case text determines the target elements according to the target case text by the element coding model, and determines the element expression vectors corresponding to the target elements according to the target case text and the target elements, if the target elements are multiple, the element expression vectors corresponding to the multiple target elements can be obtained based on the element coding model, after the element expression vectors corresponding to the multiple target elements are obtained, the element expression vectors corresponding to the multiple target elements form an element matrix, and all elements related to the target case text are represented by the element matrix.
After obtaining an element expression vector corresponding to one element or an element matrix consisting of element expression vectors corresponding to a plurality of target elements, the element expression vector is input as a question expression vector together with a target case text into a trained element content extraction model, and the element content extraction model obtains the answer of a question represented by the input question expression vector, namely, the element content corresponding to the element.
The above embodiment mentions that the element content required to be acquired for a target element is one of the following: the text segment describing the target element in the target case text, the indication information that the target element is not mentioned by the target case text, the indication information that the situation described by the target element in the target case text is actual, and the indication information that the situation described by the target element in the target case text is not actual need to be illustrated, it should be noted that the content of the element to be extracted may be different for different elements, for example, it needs to be determined whether the target element 1 is mentioned by the target case text for the target element 1, it needs to be determined whether the situation described by the target element 2 in the target case text is actual for the target element 2, it needs to obtain the text segment describing the target element 3 in the target case text for the target element 3, in order to simultaneously realize the above-mentioned extraction task, the present application inputs the input data into the element content extraction model, and extracts the content of the element corresponding to the target element from the input data based on the element content extraction model.
When there are a plurality of target elements, the extraction of the content of the batch element can be realized based on the sliding window, and if there are I target elements, the sliding window is composed of one hot encoding vector with length IWhen "1" in the sliding window, i.e., the one hot encoded vector, is located at the 1 st position (the first position in the one hot encoded vector is "1", and the other positions are "0"), it indicates that the element content corresponding to the first target element needs to be predicted, and when "1" in the sliding window, i.e., the one hot encoded vector, is located at the 2 nd position (the second position in the one hot encoded vector is "1", and the other positions are "0"), it indicates that the element content corresponding to the second target element needs to be predicted, and so on. When element content corresponding to each target element is predicted, the actual prediction is the position of the initial character and the position of the end character of the element content corresponding to the target element, and optionally, the position of the initial character can be determined by the subscript I of the initial character start Characterisation, likewise, the position of the end character can be defined by the suffix I of the end character end Characterization, thus, the element content extraction model is directed to the ith target element f i The output prediction result is (I) start ,I end , f i ) If there are multiple target elements, the element content extraction model outputs I triples.
If there are a plurality of target elements, the sliding window is slid according to the number of elements (i.e., the position of "1" in the one hot encoded vector is changed), and if there is one target element, the sliding window is fixed (i.e., the position of "1" in the one hot encoded vector is not changed). When a plurality of target elements are provided, prediction may be performed by a prediction-by-prediction method, in addition to the batch prediction method described above, and when the batch prediction method is employed, one input data (i.e., the target data x described in the above embodiment) is constructed, and when the expression vectors corresponding to all the target elements are put together into the input data of the element content extraction model, and when prediction is performed by a prediction-by-prediction method, how many input data are constructed, and the element expression vector corresponding to one target element is put into one input data.
The above embodiment mentions that the element content extraction model includes a case coding module and an element attention module, and after the structured input data is input into the case coding module, the case coding module outputs a case representation vector in which element information of the target element is fused, it should be noted that, if there is no element that does not appear during training in the target element, after the case representation vector is obtained, attention calculation needs to be performed by the element attention module, and finally, the position of the start character and the position of the end character of the element content are determined according to the result of the attention calculation, and if there is an element that does not appear during training in the target element, it needs to perform prediction one by one for the elements that do not appear, and during prediction, the position of the start character and the position of the end character of the element content are determined directly according to the output of the case coding module without performing attention calculation, and for the elements that appear during training, it can perform prediction one by one or batch prediction, and attention calculation needs to perform attention calculation, that is to the element that does not appear during training, and the element content extraction module does not participate in the calculation.
The element content acquisition method provided by the embodiment has the following advantages: the elements and the element contents corresponding to the elements can be automatically determined without manual participation; no element needs to be converted into a problem; the extraction of element contents can be realized aiming at a single element, and also can be realized aiming at batch elements; the extraction of text segments can be realized, and the analysis and judgment of elements can also be realized; the content of elements corresponding to elements appearing in the model training phase can be determined, and the content of elements corresponding to elements not appearing in the model training phase can also be determined.
Fifth embodiment
The embodiment of the present application further provides an element content acquiring apparatus, which is described below, and the element content acquiring apparatus described below and the element content acquiring method described above may be referred to in correspondence with each other.
Referring to fig. 8, a schematic structural diagram of an element content acquiring apparatus provided in the embodiment of the present application is shown, and the apparatus may include: a case text acquisition module 801, an element representation vector determination module 802, and an element content acquisition module 803. Wherein:
a case text acquiring module 801, configured to acquire a target case text.
An element representation vector determining module 802, configured to determine a target element based on the target case text, and determine an element representation vector corresponding to the target element based on the target case text and the target element.
Preferably, the element representation vector corresponding to the target element is used for representing the semantics of the target element, the semantics of the target element in the target case text and the relationship between the target element and the target case text.
An element content obtaining module 803, configured to obtain element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
Optionally, the element representation vector determining module 802 may include: an element determination submodule and an element representation vector determination submodule.
And the element determining submodule is used for determining the target elements based on the target case text and a pre-trained element coding model.
The element representation vector determining submodule is used for determining an element representation vector corresponding to the target element based on the target element, the target case text and the element coding model;
the element coding model is obtained by training a first sample containing case texts, elements and element contents, the elements in the first sample correspond to real problems, the answers of the problems are the element contents in the first sample, and the training targets of the element coding model are the problems predicted according to element representation vectors output by an element coding module and tend to the real problems corresponding to the elements in the first sample.
Optionally, the element content corresponding to the target element is one or more of the following:
a text segment describing the target element in the target case text, indication information that the target element is not mentioned by the target case text, indication information that the situation described by the target element in the target case text is true, and indication information that the situation described by the target element in the target case text is not true.
Optionally, the element content obtaining module 803 is specifically configured to obtain the element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element, and a pre-trained element content extraction model.
The element content extraction model is obtained by training a second sample containing case text and element representation vectors and real element content corresponding to elements represented by the element representation vectors in the second sample, and the element representation vectors in the second sample are obtained on the basis of the case text in the second sample and the element coding model.
Optionally, the parameters of the element content extraction model are initialized according to a pre-trained reading understanding model. The reading understanding model is obtained by training a third sample containing the case text and the question and the answer of the question in the third sample, and the question in the third sample is converted according to the elements related to the case text in the third sample.
Optionally, the element content obtaining module 803 includes: the device comprises a data construction module and an element content extraction module.
A data construction module, configured to form target data from the target case text and the element representation vector, the first answer identifier, the second answer identifier, the third answer identifier, and the element type identifier corresponding to the target element, where the first answer identifier, the second answer identifier, the third answer identifier, and the element type identifier corresponding to the target element are sequentially used to indicate: the target element is not mentioned by the target case text, the situation of the target element described in the target case text is true, the situation of the target element described in the target case text is not true, and the element type corresponding to the target element.
And the element content extraction module is used for extracting element contents corresponding to the target elements from the target data based on the target data and the element content extraction model.
Optionally, the element content extracting module includes: a position determining submodule and an element content extracting submodule.
And the position determining submodule is used for determining position indicating information corresponding to the target element based on the target data and the element content extraction model, wherein the position indicating information is used for indicating the position of element content corresponding to the target element in the target data.
And the element content extraction sub-module is used for extracting the element content corresponding to the target element from the target data based on the position indication information corresponding to the target element.
Optionally, the position determining submodule is specifically configured to input the target data into the element content extraction model, encode the target case text by using the element content extraction model in combination with the element representation vector in the target data, and determine the position indication information corresponding to the target element according to the case representation vector fused with the element information obtained by encoding.
Optionally, the target elements are one or more;
if the target elements are multiple, the target data comprise target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to each target element; the element content extraction model outputs position indication information corresponding to a plurality of target elements respectively, and the position indication information comprises: the corresponding target element, the position indication information of the initial character and the position indication information of the end character in the element content corresponding to the corresponding target element.
Optionally, the element content obtaining apparatus provided in this embodiment of the present application may further include: and an element coding model training module.
And an element coding model training module, configured to input the first sample into an element coding model, obtain an element representation vector corresponding to an element in the first sample output by the element coding model, determine a prediction probability of a problem corresponding to the element in the first sample based on a problem decoder, the element representation vector corresponding to the element in the first sample, and the problem corresponding to the element in the first sample, and update a parameter of the element coding model according to the prediction probability of the problem corresponding to the element in the first sample.
Optionally, when the element coding model training module inputs the first sample into the element coding model to obtain an element representation vector corresponding to an element in the first sample output by the element coding model, the element coding model training module is specifically configured to:
inputting the elements in the first sample into an element coding module of an element coding model for coding to obtain an element coding result; inputting the case text in the first sample into a case coding module of the element coding model for coding to obtain a case coding result; inputting the element content in the first sample into an element content coding module of an element coding model for coding to obtain an element content coding result; inputting the case situation coding result and the element content coding result into a data fusion module of an element coding model for fusion to obtain a fusion result; inputting the case coding result and the fusion result into a data splicing module of the element coding model for splicing to obtain a splicing result; and inputting the splicing result into an element representation vector determining module of an element coding model to obtain an element representation vector corresponding to the element in the first sample.
Optionally, the element content obtaining apparatus provided in this embodiment of the present application may further include: and the element content extraction model training module.
And the element content extraction model training module is used for inputting the second sample into an element content extraction model to obtain element content predicted for elements represented by the element representation vector in the second sample, determining the predicted loss of the element content extraction model according to the predicted element content and the real element content corresponding to the elements in the second sample, and updating the parameters of the element content extraction model according to the determined predicted loss.
Optionally, the element content acquiring apparatus provided in the embodiment of the present application may further include: and an element coding model optimization module.
And the element coding model optimizing module is used for determining the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample based on a problem decoder and the problem corresponding to the element represented by the element representation vector in the second sample, and optimizing the parameter of the element coding model according to the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample.
The element content acquisition device provided by the embodiment of the application has the following advantages: the elements and the element contents corresponding to the elements can be automatically determined without manual participation; no need to convert elements into problems; the extraction of element contents can be realized for a single element, and the extraction of the element contents can also be realized for batch elements; the extraction of text fragments can be realized, and the analysis and judgment of elements can also be realized; the content of elements corresponding to elements appearing in the model training phase can be determined, and the content of elements corresponding to elements not appearing in the model training phase can also be determined.
Sixth embodiment
An embodiment of the present application further provides an element content acquiring device, please refer to fig. 9, which shows a schematic structural diagram of the element content acquiring device, where the element content acquiring device may include: at least one processor 901, at least one communication interface 902, at least one memory 903 and at least one communication bus 904;
in the embodiment of the present application, the number of the processor 901, the communication interface 902, the memory 903, and the communication bus 904 is at least one, and the processor 901, the communication interface 902, and the memory 903 complete communication with each other through the communication bus 904;
the processor 901 may be a central processing unit CPU, or an Application Specific Integrated Circuit ASIC (Application Specific Integrated Circuit), or one or more Integrated circuits configured to implement embodiments of the present invention, etc.;
the memory 903 may include a high-speed RAM memory, a non-volatile memory (non-volatile memory), and the like, such as at least one disk memory;
wherein the memory stores a program and the processor can call the program stored in the memory, the program for:
acquiring a target case text;
determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text;
and acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
Alternatively, the detailed function and the extended function of the program may refer to the above description.
Seventh embodiment
Embodiments of the present application further provide a readable storage medium, where a program suitable for being executed by a processor may be stored, where the program is configured to:
acquiring a target case text;
determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text;
and acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element.
Alternatively, the detailed function and the extended function of the program may be as described above.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (16)

1. A method for acquiring element contents, comprising:
acquiring a target case text;
determining a target element based on the target case text, and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantics of the target element in the target case text;
acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element;
the determining a target element based on the target case text and determining an element representation vector corresponding to the target element based on the target case text and the target element includes:
determining a target element based on the target case text and a pre-trained element coding model;
determining an element representation vector corresponding to the target element based on the target element, the target case text and the element coding model;
the element coding model is obtained by training a first sample containing case texts, elements and element contents, the elements in the first sample correspond to real problems, the answers of the problems are the element contents in the first sample, and the training targets of the element coding model are the problems predicted according to element representation vectors output by an element coding module and tend to the real problems corresponding to the elements in the first sample.
2. The method for acquiring element content according to claim 1, wherein the element representation vector corresponding to the target element is further used for representing the semantic meaning of the target element and the relationship between the target element and the target case text.
3. The element content acquisition method according to claim 1, wherein the element content corresponding to the target element is one or more of the following:
the target case text comprises a text segment which describes the target element, indication information which indicates that the target element is not mentioned by the target case text, indication information which indicates that the situation described by the target element in the target case text is true, and indication information which indicates that the situation described by the target element in the target case text is not true.
4. The method according to claim 1, wherein the obtaining of the element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element comprises:
acquiring element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element and a pre-trained element content extraction model;
the element content extraction model is obtained by training a second sample containing case text and element representation vectors and real element content corresponding to elements represented by the element representation vectors in the second sample, and the element representation vectors in the second sample are obtained based on the case text in the second sample and the element coding model.
5. The method for acquiring elemental content according to claim 4, wherein parameters of the elemental content extraction model are initialized according to a pre-trained reading understanding model;
the reading understanding model is obtained by training a third sample containing case text and questions and answers of the questions in the third sample, and the questions in the third sample are converted according to elements related to the case text in the third sample.
6. The method according to claim 4, wherein the acquiring of the element content corresponding to the target element based on the target case text, the element representation vector corresponding to the target element, and a pre-trained element content extraction model comprises:
target data is composed of the target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to the target elements, wherein the first answer identifiers, the second answer identifiers, the third answer identifiers and the element type identifiers corresponding to the target elements are sequentially used for indicating: the target element is not mentioned by the target case text, the situation of the target element described in the target case text is true, the situation of the target element described in the target case text is not true, and the element type corresponding to the target element;
and extracting element content corresponding to the target element from the target data based on the target data and the element content extraction model.
7. The method for acquiring elemental content according to claim 6, wherein the extracting elemental content corresponding to the target element from the target data based on the target data and the elemental content extraction model includes:
determining position indication information corresponding to the target element based on the target data and the element content extraction model, wherein the position indication information is used for indicating the position of element content corresponding to the target element in the target data;
and extracting element content corresponding to the target element from the target data based on the position indication information corresponding to the target element.
8. The method for acquiring elemental content according to claim 7, wherein the determining position indication information corresponding to the target element based on the target data and the elemental content extraction model includes:
and inputting the target data into the element content extraction model, coding the target case text by combining the element content extraction model with the element expression vector in the target data, and determining the position indication information corresponding to the target element according to the case expression vector which is obtained by coding and is fused with the element information.
9. The element content acquiring method according to claim 7, wherein the target element is one or more;
if the target elements are multiple, the target data comprise target case text, and element representation vectors, first answer identifiers, second answer identifiers, third answer identifiers and element type identifiers corresponding to each target element; the element content extraction model outputs position indication information corresponding to a plurality of target elements respectively, and the position indication information comprises: the corresponding target element, the position indication information of the initial character and the position indication information of the end character in the element content corresponding to the corresponding target element.
10. The method according to claim 1, wherein the training process of the element coding model comprises:
inputting the first sample into an element coding model to obtain an element representation vector corresponding to an element in the first sample output by the element coding model;
determining a prediction probability of a problem corresponding to an element in the first sample based on a problem decoder, an element representation vector corresponding to an element in the first sample, and a problem corresponding to an element in the first sample;
and updating the parameters of the element coding model according to the prediction probability of the problem corresponding to the element in the first sample.
11. The method for acquiring elemental content according to claim 10, wherein the step of inputting the first sample into an elemental coding model to obtain an elemental expression vector corresponding to an element in the first sample output by the elemental coding model comprises:
inputting the elements in the first sample into an element coding module of an element coding model for coding to obtain an element coding result;
inputting the case text in the first sample into a case coding module of the element coding model for coding to obtain a case coding result;
inputting the element content in the first sample into an element content coding module of an element coding model for coding to obtain an element content coding result;
inputting the case coding result and the element content coding result into a data fusion module of an element coding model for fusion to obtain a fusion result;
inputting the case coding result and the fusion result into a data splicing module of the element coding model for splicing to obtain a splicing result;
and inputting the splicing result into an element representation vector determining module of an element coding model to obtain an element representation vector corresponding to the element in the first sample.
12. The method according to claim 4, wherein the training process of the element content extraction model includes:
inputting the second sample into an element content extraction model to obtain element content predicted for elements represented by element representation vectors in the second sample;
determining the prediction loss of the element content extraction model according to the predicted element content and the real element content corresponding to the elements in the second sample;
and updating parameters of the element content extraction model according to the determined prediction loss.
13. The element content acquisition method according to claim 12, characterized by further comprising:
determining a prediction probability of a problem corresponding to an element represented by the element representation vector in the second sample based on a problem decoder and the problem corresponding to the element represented by the element representation vector in the second sample;
and optimizing the parameters of the element coding model according to the prediction probability of the problem corresponding to the element represented by the element representation vector in the second sample.
14. An element content acquisition apparatus characterized by comprising: the system comprises a case text acquisition module, a factor representation vector determination module and a factor content acquisition module;
the case text acquisition module is used for acquiring a target case text;
the element representation vector determining module is used for determining a target element based on the target case text and determining an element representation vector corresponding to the target element based on the target case text and the target element, wherein the element representation vector corresponding to the target element is used for representing the semantic meaning of the target element in the target case text;
the element content acquisition module is used for acquiring element content corresponding to the target element based on the target case text and the element representation vector corresponding to the target element;
the element expression vector determining module is specifically configured to determine a target element based on the target case text and a pre-trained element coding model, and determine an element expression vector corresponding to the target element based on the target element, the target case text and the element coding model;
the element coding model is obtained by training a first sample containing case texts, elements and element contents, the elements in the first sample correspond to real problems, the answers of the problems are the element contents in the first sample, and the training targets of the element coding model are the problems predicted according to element representation vectors output by an element coding module and tend to the real problems corresponding to the elements in the first sample.
15. An elemental content acquiring apparatus characterized by comprising: a memory and a processor;
the memory is used for storing programs;
the processor executes the program to realize each step of the element content acquisition method according to any one of claims 1 to 13.
16. A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of the elemental content obtaining method according to any one of claims 1 to 13.
CN202110319845.7A 2021-03-25 2021-03-25 Element content obtaining method, device, equipment and storage medium Active CN113157880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110319845.7A CN113157880B (en) 2021-03-25 2021-03-25 Element content obtaining method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110319845.7A CN113157880B (en) 2021-03-25 2021-03-25 Element content obtaining method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113157880A CN113157880A (en) 2021-07-23
CN113157880B true CN113157880B (en) 2023-01-17

Family

ID=76885073

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110319845.7A Active CN113157880B (en) 2021-03-25 2021-03-25 Element content obtaining method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113157880B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113990460B (en) * 2021-09-07 2023-02-17 安徽讯飞医疗股份有限公司 Inquiry recommendation method, computer equipment and storage device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014215920A (en) * 2013-04-26 2014-11-17 日本電信電話株式会社 Case analysis model parameter learning apparatus, case analyzer, method and program
CN110276068A (en) * 2019-05-08 2019-09-24 清华大学 Law merit analysis method and device
CN110334217A (en) * 2019-05-10 2019-10-15 科大讯飞股份有限公司 A kind of element abstracting method, device, equipment and storage medium
CN110969018A (en) * 2018-09-30 2020-04-07 北京国双科技有限公司 Case description element extraction method, machine learning model acquisition method and device
CN111324743A (en) * 2020-02-14 2020-06-23 平安科技(深圳)有限公司 Text relation extraction method and device, computer equipment and storage medium
CN112417104A (en) * 2020-12-04 2021-02-26 山西大学 Machine reading understanding multi-hop inference model and method with enhanced syntactic relation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014215920A (en) * 2013-04-26 2014-11-17 日本電信電話株式会社 Case analysis model parameter learning apparatus, case analyzer, method and program
CN110969018A (en) * 2018-09-30 2020-04-07 北京国双科技有限公司 Case description element extraction method, machine learning model acquisition method and device
CN110276068A (en) * 2019-05-08 2019-09-24 清华大学 Law merit analysis method and device
CN110334217A (en) * 2019-05-10 2019-10-15 科大讯飞股份有限公司 A kind of element abstracting method, device, equipment and storage medium
CN111324743A (en) * 2020-02-14 2020-06-23 平安科技(深圳)有限公司 Text relation extraction method and device, computer equipment and storage medium
CN112417104A (en) * 2020-12-04 2021-02-26 山西大学 Machine reading understanding multi-hop inference model and method with enhanced syntactic relation

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An Architecture for Extracting Key Elements from Legal Permits;Anna Breit etc.;《 2020 IEEE International Conference on Big Data (Big Data)》;20210319;第2105-2110页 *
ED-GAN:基于改进生成对抗网络的法律文本生成模型;康云云 等;《小型微型计算机系统》;20190531;第1020-1025页 *
基于神经网络和注意力机制的阅读理解式问答模型研究;肖林龙;《中国优秀硕士学位论文全文数据库(信息科技辑)》;20200115;第I138-2638页 *

Also Published As

Publication number Publication date
CN113157880A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
CN110222188B (en) Company notice processing method for multi-task learning and server
CN110990543A (en) Intelligent conversation generation method and device, computer equipment and computer storage medium
CN110188331A (en) Model training method, conversational system evaluation method, device, equipment and storage medium
CN111783474A (en) Comment text viewpoint information processing method and device and storage medium
CN108959246A (en) Answer selection method, device and electronic equipment based on improved attention mechanism
CN111061856A (en) Knowledge perception-based news recommendation method
CN110825867B (en) Similar text recommendation method and device, electronic equipment and storage medium
CN112069811A (en) Electronic text event extraction method with enhanced multi-task interaction
CN113836298A (en) Text classification method and system based on visual enhancement
CN109871452B (en) Method, apparatus and storage medium for determining crime characteristics
CN113779260B (en) Pre-training model-based domain map entity and relationship joint extraction method and system
CN113657115B (en) Multi-mode Mongolian emotion analysis method based on ironic recognition and fine granularity feature fusion
CN109919175A (en) A kind of more classification methods of entity of combination attribute information
CN116578688A (en) Text processing method, device, equipment and storage medium based on multiple rounds of questions and answers
CN114818717A (en) Chinese named entity recognition method and system fusing vocabulary and syntax information
CN113157880B (en) Element content obtaining method, device, equipment and storage medium
CN110852071B (en) Knowledge point detection method, device, equipment and readable storage medium
CN115775349A (en) False news detection method and device based on multi-mode fusion
CN113239678B (en) Multi-angle attention feature matching method and system for answer selection
CN111477212A (en) Content recognition, model training and data processing method, system and equipment
CN115186071A (en) Intention recognition method and device, electronic equipment and readable storage medium
CN114722817B (en) Event processing method and device
CN115292495A (en) Emotion analysis method and device, electronic equipment and storage medium
CN113096646B (en) Audio recognition method and device, electronic equipment and storage medium
CN114239565A (en) Deep learning-based emotion reason identification method and system

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