A method and device for recognizing a parallel structure, an electronic device, and a storage medium
By generating sentence vectors and parallel structure vectors, and combining them with a prediction model to filter out parallel structures of the target relationship type, the problem that existing tools cannot identify the association of parallel structures is solved, thus improving the accuracy of fault attribution analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING XUEZHITU NETWORK TECH
- Filing Date
- 2022-09-29
- Publication Date
- 2026-07-03
AI Technical Summary
Existing natural language syntactic analysis tools cannot effectively identify the relationships between parallel structures, resulting in insufficient accuracy in fault attribution analysis, especially in causal fault analysis where they cannot filter out parallel structures with causal relationships.
By extracting parallel structures from the text, sentence vectors and parallel structure vectors are generated using a bidirectional representation model and a classification model. Combined with a prediction model, parallel structures of the target relation type are selected, including parallel structures that share a subject or a object, thus simplifying the syntactic analysis process.
It improves the accuracy of parallel structure recognition, effectively filters out parallel structures that meet project requirements, satisfies the accuracy requirements of fault attribution analysis, and simplifies the syntactic analysis process.
Smart Images

Figure CN115455941B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and more specifically, to a method, apparatus, electronic device, and storage medium for recognizing parallel structures. Background Technology
[0002] Existing natural language syntactic analysis tools, such as LTP (Harbin Institute of Technology Language Technology Platform) and CoreNLP (Stanford Natural Language Processing Toolkit), all have syntactic analysis capabilities and can extract parallel structures. However, these toolkits cannot determine the relationships between parallel structures and therefore cannot be directly applied to the identification of parallel events in fault attribution analysis. For example, in causal fault analysis, only parallel structures with causal relationships need to be extracted. If fault analysis is performed based on all parallel structures, it will affect the accuracy of fault attribution analysis. Therefore, a fine-grained method for identifying parallel structures is needed. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a method, apparatus, electronic device and storage medium for identifying parallel structures, and to further filter out the required parallel structures from the identified parallel structures in order to meet the project requirements of fault attribution analysis.
[0004] In a first aspect, this application provides a method for recognizing parallel structures, comprising: for each text, extracting multiple parallel structures from the text, each parallel structure consisting of a first short sentence and a second short sentence with a parallel relationship; determining multiple sets of text information, each set of text information including a parallel structure and the text to which the parallel structure belongs; for each set of text information, determining a predicted value corresponding to the parallel structure in the set of text information based on the sentence vector and the parallel structure vector of the set of text information, wherein the sentence vector is used to characterize the semantics of the set of text information, the parallel structure vector is used to characterize the semantics of the parallel structure, and the predicted value is used to characterize the probability that the relation type of the parallel structure is the target relation type; and determining the relation type of each parallel structure based on the predicted value corresponding to each parallel structure.
[0005] Preferably, the predicted value corresponding to each parallel structure is determined in the following way: For each set of text information, the set of text information is input into the target prediction model to output the predicted value corresponding to the parallel structure in the set of text information. The target prediction model is a model corresponding to the target relation type. The target prediction model performs the following processing: Determine the sentence vector and parallel structure vector of the set of text information, and determine the predicted value corresponding to the parallel structure in the set of text information based on the determined sentence vector and parallel structure vector. The prediction model corresponding to the target relation type is obtained in the following way: Obtain multiple training texts, each training text containing parallel syntax; extract all parallel structures in each training text; add labels to each parallel structure, the labels indicating the relation type of the parallel structure; determine multiple sets of training information, each set of training information including a parallel structure and the training text to which the parallel structure belongs; for each set of training information, train the initial prediction model using the set of training information to obtain the prediction model corresponding to the target relation type.
[0006] Preferably, the target prediction model includes a bidirectional representation model and a classification model, wherein the predicted value corresponding to each parallel structure is generated in the following manner: for each group of text information, the group of text information is input into the bidirectional representation model to obtain the sentence vector and parallel structure vector of the group of text information; for each group of text information, the sentence vector and parallel structure vector of the group of text information are input into the classification model to output the predicted value corresponding to the parallel structure in the group of text information.
[0007] Preferably, the parallel structure includes a first short sentence and a second short sentence. The parallel structure vector of each group of text information is determined by the following method: determining all characters corresponding to the group of text information and generating a character vector corresponding to each character; determining all character vectors corresponding to the first short sentence and the second short sentence in the sample original text of the group of text information; for any short sentence in the first short sentence and the second short sentence, taking the mean of all character vectors corresponding to the short sentence as the first short sentence vector or the second short sentence vector; and determining the first short sentence vector and the second short sentence vector as the parallel structure vector of the group of text information.
[0008] Preferably, the classification model includes a contact layer, a fully connected layer, and a normalization layer. For each set of text information, the predicted value corresponding to the parallel structure in the set of text information is output in the following way: the first short sentence vector, sentence vector, and second short sentence vector output by the bidirectional representation model are input into the contact layer in sequence; the contact layer concatenates the input vectors and outputs the concatenated vector to the fully connected layer; the fully connected layer classifies the input and outputs the classification result to the normalization layer; the normalization layer normalizes the classification result to output the predicted value corresponding to the parallel structure in the set of text information.
[0009] Preferably, multiple parallel structures in each text are extracted in the following manner: the text is input into a first parallel structure recognition model to obtain multiple first parallel structures, wherein the first parallel structure recognition model is a parallel structure recognition model constructed based on standard parallel grammar rules; the text is input into a second parallel structure recognition model to obtain multiple second parallel structures, wherein the second parallel structure recognition model is a parallel structure recognition model constructed based on custom parallel grammar rules in the target technical field, wherein the target technical field is the technical field to which multiple texts belong; the multiple first parallel structures and the multiple second parallel structures are deduplicated; the deduplicated parallel structures are determined as the multiple parallel structures extracted from the text.
[0010] Preferably, for each parallel structure, the relationship type of the parallel structure is determined by the following method: determining the magnitude of the predicted value corresponding to the parallel structure and the standard predicted value; if the predicted value of the parallel structure is greater than the standard predicted value, then the relationship type of the parallel structure is determined to be the target relationship type; if the predicted value of the parallel structure is less than the standard predicted value, then the relationship type of the parallel structure is determined to be not the target relationship type.
[0011] Secondly, this application provides a device for identifying parallel structures, comprising:
[0012] The extraction module is used to extract multiple parallel structures from each text, where each parallel structure consists of a first short sentence and a second short sentence that have a parallel relationship.
[0013] The grouping module is used to identify multiple groups of text information, each group of text information including a parallel structure and the text to which the parallel structure belongs;
[0014] The prediction module is used to determine the predicted value of the parallel structure in each set of text information based on the sentence vector and parallel structure vector of the set of text information. The sentence vector is used to represent the semantics of the set of text information, the parallel structure vector is used to represent the semantics of the parallel structure, and the predicted value is used to represent the probability that the relation type of the parallel structure is the target relation type.
[0015] The judgment module is used to determine the relationship type of each parallel structure based on the predicted value corresponding to each parallel structure.
[0016] Thirdly, this application also provides an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the parallel structure identification method described above are performed.
[0017] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the parallel structure identification method described above.
[0018] The method, apparatus, electronic device, and storage medium for identifying parallel structures provided in this application extract multiple parallel structures from each text. Each parallel structure consists of a first short sentence and a second short sentence that have a parallel relationship. Multiple sets of text information are identified, each set including a parallel structure and the text to which that parallel structure belongs. For each set of text information, a predicted value corresponding to the parallel structure is determined based on the sentence vector and parallel structure vector of that set of text information. The sentence vector represents the semantics of that set of text information, the parallel structure vector represents the semantics of the parallel structure, and the predicted value represents the probability that the relationship type of the parallel structure is the target relationship type. The relationship type of each parallel structure is determined based on the predicted value corresponding to each parallel structure. Compared with the prior art of extracting parallel structures using natural language syntactic analysis tools, this method can further filter out the required parallel structures to meet the project requirements of fault attribution analysis.
[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating a method for identifying parallel structures provided in an embodiment of this application;
[0022] Figure 2 A flowchart illustrating a step for determining a relationship type, provided as an embodiment of this application;
[0023] Figure 3 A flowchart illustrating the steps of training a prediction model provided in this application embodiment;
[0024] Figure 4 A flowchart illustrating a step for extracting parallel structures provided in an embodiment of this application;
[0025] Figure 5 A flowchart illustrating the steps for determining a parallel structure vector provided in this application embodiment;
[0026] Figure 6 This is a schematic diagram of the structure of a parallel-structure identification device provided in an embodiment of this application;
[0027] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0029] First, the applicable application scenarios of this application are introduced. This application can be applied to information extraction in fault attribution analysis.
[0030] Existing natural language syntactic analysis tools, such as LTP (Harbin Institute of Technology Language Technology Platform) and CoreNLP (Stanford Natural Language Processing Toolkit), all have syntactic analysis capabilities and can extract parallel structures. However, these toolkits cannot determine the relationships between parallel structures and therefore cannot be directly applied to the identification of parallel events in fault attribution analysis. For example, in causal fault analysis, only parallel structures with causal relationships need to be extracted. If fault analysis is performed based on all parallel structures, it will affect the accuracy of fault attribution analysis. Therefore, a fine-grained method for identifying parallel structures is needed.
[0031] Based on this, embodiments of this application provide a method, apparatus, electronic device, and storage medium for identifying parallel structures.
[0032] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for identifying parallel structures provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method for identifying parallel structures can be executed using a parallel structure identification toolkit. The steps of the method include:
[0033] S101. For each text, extract multiple parallel structures from the text. Each parallel structure consists of a first short sentence and a second short sentence that have a parallel relationship.
[0034] In this step, the text can be input into a parallel structure recognition toolkit, which first extracts all parallel structures from the text. Here, the parallel structure recognition function of the toolkit can be developed using existing natural language parsing tools, such as LTP (Language Technology Platform). The extracted parallel structures could be "Yang Guo is the protagonist of The Return of the Condor Heroes" and "Guo Jing is the protagonist of The Legend of the Condor Heroes".
[0035] S102. Determine multiple sets of text information, each set of text information including a parallel structure and the text to which the parallel structure belongs.
[0036] In this step, the current text needs to be grouped with each parallel structure extracted from the current text as a set of text information. It can be understood that each set of text information can be in the form of {text, (first short sentence, second short sentence)}.
[0037] S103. For each set of text information, based on the sentence vector and parallel structure vector of the set of text information, determine the predicted value corresponding to the parallel structure in the set of text information. The sentence vector is used to represent the semantics of the set of text information, the parallel structure vector is used to represent the semantics of the parallel structure, and the predicted value is used to represent the probability that the relation type of the parallel structure is the target relation type.
[0038] Specifically, the predicted value for each parallel structure is determined in the following way:
[0039] For each set of text information, the set is input into the target prediction model to output the predicted value corresponding to the parallel structure in the set of text information. The target prediction model is the model corresponding to the target relation type. The target prediction model performs the following processing: determines the sentence vector and parallel structure vector of the set of text information, and determines the predicted value corresponding to the parallel structure in the set of text information based on the determined sentence vector and parallel structure vector.
[0040] Here, the target prediction model can be determined based on project requirements. The target relationship type can be shared subject, shared object, or have a common causal orientation. It can be understood that the prediction model corresponding to the target relationship type is generated based on the parallel structure labeled with target parallel relationships.
[0041] S104. Determine the relationship type of each parallel structure based on the predicted value corresponding to each parallel structure.
[0042] Figure 2This is a flowchart illustrating a step for determining a relationship type according to an embodiment of this application. Specifically, for each parallel structure, the relationship type of the parallel structure is determined in the following manner:
[0043] S1040. Determine the magnitude of the predicted value and the standard predicted value corresponding to the parallel structure;
[0044] S1042. If the predicted value of the parallel structure is greater than the standard predicted value, then the relation type of the parallel structure is determined to be the target relation type.
[0045] S1044. If the predicted value of the parallel structure is less than the standard predicted value, then the relation type of the parallel structure is determined to be the target relation type.
[0046] In this step, the standard prediction value corresponding to the target relation type can be determined first. For example, when the target relation type is a shared subject, if the corresponding standard prediction value is determined to be 0.5, then the relation type of parallel structures with prediction values greater than 0.5 can be determined as a shared subject. After extracting the parallel structures that belong to the shared subject category, causal failure analysis can be performed based on the extracted parallel structures.
[0047] The parallel structure identification method provided in this application uses existing toolkits to identify parallel structures, then inputs the identified parallel structures into a prediction model, and determines the parallel structure relationship type based on the output of the prediction model. This can further identify parallel structures of project requirements. The entire process does not require complex syntactic analysis tasks; only simple classification tasks are needed to obtain the target of syntactic analysis, thus simplifying the syntactic analysis process.
[0048] Figure 3 This is a flowchart illustrating the steps of training a prediction model according to an embodiment of this application. In one embodiment of this application, a prediction model corresponding to the target relation type can be obtained in the following manner:
[0049] S201. Obtain multiple training texts, each of which contains parallel syntax.
[0050] First, based on the domain analyzed in the fault attribution analysis, identify text within the same domain. This could be done by retrieving text from the internet. Alternatively, text containing parallel syntax can be filtered out, and the parallel structures within each text segment can be extracted.
[0051] S202. Extract all parallel structures from each training text.
[0052] Figure 4This is a flowchart illustrating a step for extracting parallel structures as provided in an embodiment of this application. Multiple parallel structures in each text can be extracted in the following manner:
[0053] S2020. Input the text into the first parallel structure recognition model to obtain multiple first parallel structures. The first parallel structure recognition model is a parallel structure recognition model built based on standard parallel syntax rules.
[0054] S2022. Input the text into the second parallel structure recognition model to obtain multiple second parallel structures. The second parallel structure recognition model is a parallel structure recognition model constructed based on custom parallel syntax rules under the target technical field. The target technical field is the technical field to which multiple texts belong.
[0055] Here, parallel structures can be extracted from large-scale text using both the LTP model (first parallel structure recognition model) and manually defined templates (second parallel structure recognition model). The manually defined templates can be matched by setting keywords representing parallel relationships. Keywords representing parallel relationships can include "is...and" or "and," etc.
[0056] S2024. Perform deduplication processing on multiple first parallel structures and multiple second parallel structures.
[0057] S2026. The deduplicated parallel structures are identified as multiple parallel structures extracted from the text.
[0058] Here, two models are used to extract the parallel structure of the same text in order to increase the number of samples. By training the initial prediction model with diverse samples, the accuracy of the prediction model is improved.
[0059] S203. Add a label to each parallel structure. The label is used to indicate the relationship type of the parallel structure.
[0060] Here, parallel structures are manually labeled. Taking the target relationship type as shared subject as an example, the label of parallel structures that belong to shared subject is 1, and the label of parallel structures that do not belong to shared subject is 0.
[0061] S204. Determine multiple sets of training information, each set of training information including a parallel structure and the training text to which the parallel structure belongs.
[0062] S205. For each set of training information, train the initial prediction model using the set of training information to obtain a prediction model corresponding to the target relationship type.
[0063] Here, you can input the training text into the initial prediction model in the format of {training text, (first short sentence, second short sentence)}. This initial prediction model can include two parts: a bidirectional representation model and a classification model.
[0064] Specifically, the target prediction model includes a bidirectional representation model and a classification model, wherein the predicted value for each parallel structure is generated in the following way:
[0065] For each set of text information, the text information is input into a bidirectional representation model to obtain the sentence vector and parallel structure vector of the text information; for each set of text information, the sentence vector and parallel structure vector of the text information are input into a classification model to output the predicted value corresponding to the parallel structure in the text information.
[0066] In this embodiment, a pre-trained bidirectional representation model (hereinafter referred to as the BERT model) can be used for training and inference. The BERT model is constructed with inputs of {[cls]... <e1> First short sentence< / e1> … <e2> Second short sentence< / e2> …[sep]short phrase 1 [sep]short phrase 2}. That is, in the training text through <e1>< / e1> Mark the first short sentence and use it in the training text. <e2>< / e2> Mark the second short sentence and separate the sample text, the first short sentence, and the second short sentence using [sep].
[0067] Figure 5 This is a flowchart illustrating a step for determining a parallel structure vector according to an embodiment of this application. Specifically, the parallel structure includes a first short sentence and a second short sentence, and the parallel structure vector for each group of text information can be determined in the following manner:
[0068] S301. Determine all characters corresponding to the group of text information and generate a character vector for each character;
[0069] S302. Determine all character vectors corresponding to the first and second short sentences in the original sample text of this set of text information;
[0070] S303. For any one of the first and second short sentences, take the average of all character vectors corresponding to that short sentence as the first short sentence vector or the second short sentence vector.
[0071] S304. Determine the first short sentence vector and the second short sentence vector as the parallel structure vector of this group of text information.
[0072] The BERT model can be used to extract the CLS sentence vectors (sentence vectors) separately. <e1>< / e1> Between and <e2>< / e2>The word vectors between them are pooled using mean pooling to obtain avg1 (the first short sentence vector) and avg2 (the second short sentence vector).
[0073] Next, the first short sentence vector, sentence vector, and second short sentence vector output by the BERT model are input into the classification model.
[0074] Specifically, the classification model includes a contact layer, a fully connected layer, and a normalization layer. For each set of text information, the predicted value corresponding to the parallel structure in that set of text information is output in the following way:
[0075] The first short sentence vector, sentence vector, and second short sentence vector output by the bidirectional representation model are sequentially input into the contact layer. The contact layer concatenates the input vectors and outputs the concatenated vector to the fully connected layer. The fully connected layer classifies the input and outputs the classification result to the normalization layer. The normalization layer normalizes the classification result to output the predicted value corresponding to the parallel structure in the text information.
[0076] The classification model can be represented as sigmoid(fc(contact(cls,avg1,avg2))). Here, contact is the contact layer, used to concatenate vectors. fc is the fully connected layer, used to convert the vector dimension to 1. sigmoid is the normalization layer, used for binary classification, normalizing the values to the {0, 1} interval.
[0077] In this embodiment, the original text and parallel structures are input into the prediction model together to obtain corresponding sentence vectors and short sentence vectors, and prediction classification is performed based on the sentence vectors and short sentence vectors. Here, the semantics represented by the sentence vectors are closer to the semantics of the short sentences, resulting in more accurate classification results and thus improving the accuracy of identifying parallel structures of the target relation type. Furthermore, in actual fault attribution analysis, the proportion of parallel structures containing the target relation type is relatively low. If syntactic analysis is performed using existing methods, a significant amount of time is wasted on labeling parallel structures of non-target relation types during the annotation process. Therefore, training the prediction model using the above method can save more annotation and training time.
[0078] Based on the same inventive concept, this application also provides a parallel structure identification device corresponding to the parallel structure identification method. Since the principle of the device in this application is similar to the parallel structure identification method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0079] Please see Figure 6 , Figure 6 This is a schematic diagram of a parallel-structure identification device provided in an embodiment of this application. Figure 6As shown, the identification device 600 for the parallel structure includes:
[0080] Extraction module 610 is used to extract multiple parallel structures from each text, each parallel structure consisting of a first short sentence and a second short sentence that have a parallel relationship;
[0081] Grouping module 620 is used to determine multiple groups of text information, each group of text information including a parallel structure and the text to which the parallel structure belongs;
[0082] The prediction module 630 is used to determine the predicted value corresponding to the parallel structure in each set of text information based on the sentence vector and parallel structure vector of the set of text information. The sentence vector is used to represent the semantics of the set of text information, the parallel structure vector is used to represent the semantics of the parallel structure, and the predicted value is used to represent the probability that the relation type of the parallel structure is the target relation type.
[0083] The judgment module 640 is used to determine the relationship type of each parallel structure based on the predicted value corresponding to each parallel structure.
[0084] In a preferred embodiment, the prediction module 630 is specifically used to input each set of text information into a target prediction model to output the predicted value corresponding to the parallel structure in the set of text information. The target prediction model is a model corresponding to the target relation type. The target prediction model performs the following processing: determining the sentence vector and parallel structure vector of the set of text information, and determining the predicted value corresponding to the parallel structure in the set of text information based on the determined sentence vector and parallel structure vector. The prediction model corresponding to the target relation type is obtained by: acquiring multiple training texts, each training text containing parallel syntax; extracting all parallel structures in each training text; adding labels to each parallel structure to indicate the relation type of the parallel structure; determining multiple sets of training information, each set of training information including a parallel structure and the training text to which the parallel structure belongs; and training the initial prediction model using each set of training information to obtain the prediction model corresponding to the target relation type.
[0085] In a preferred embodiment, the target prediction model includes a bidirectional representation model and a classification model, wherein the predicted value corresponding to each parallel structure is generated in the following manner: for each set of text information, the set of text information is input into the bidirectional representation model to obtain the sentence vector and parallel structure vector of the set of text information; for each set of text information, the sentence vector and parallel structure vector of the set of text information are input into the classification model to output the predicted value corresponding to the parallel structure in the set of text information.
[0086] In a preferred embodiment, the parallel structure includes a first short sentence and a second short sentence. The parallel structure vector of each group of text information is determined by: determining all characters corresponding to the group of text information and generating a character vector corresponding to each character; determining all character vectors corresponding to the first short sentence and the second short sentence in the sample original text of the group of text information; for any short sentence in the first short sentence and the second short sentence, taking the average of all character vectors corresponding to the short sentence as the first short sentence vector or the second short sentence vector; and determining the first short sentence vector and the second short sentence vector as the parallel structure vector of the group of text information.
[0087] In a preferred embodiment, the classification model includes a contact layer, a fully connected layer, and a normalization layer. For each set of text information, the predicted value corresponding to the parallel structure in the set of text information is output in the following manner: the first short sentence vector, sentence vector, and second short sentence vector output by the bidirectional representation model are input into the contact layer in sequence; the contact layer concatenates the input vectors and outputs the concatenated vector to the fully connected layer; the fully connected layer classifies the input and outputs the classification result to the normalization layer; the normalization layer normalizes the classification result to output the predicted value corresponding to the parallel structure in the set of text information.
[0088] In a preferred embodiment, multiple parallel structures in each text are extracted as follows: the text is input into a first parallel structure recognition model to obtain multiple first parallel structures, wherein the first parallel structure recognition model is a parallel structure recognition model constructed based on standard parallel grammar rules; the text is input into a second parallel structure recognition model to obtain multiple second parallel structures, wherein the second parallel structure recognition model is a parallel structure recognition model constructed based on custom parallel grammar rules in the target technical field, wherein the target technical field is the technical field to which multiple texts belong; the multiple first parallel structures and the multiple second parallel structures are deduplicated; and the deduplicated parallel structures are determined as the multiple parallel structures extracted from the text.
[0089] In a preferred embodiment, the determination module 640 is specifically used to determine the magnitude of the predicted value corresponding to the parallel structure and the standard predicted value; if the predicted value of the parallel structure is greater than the standard predicted value, then the relation type of the parallel structure is determined to be the target relation type; if the predicted value of the parallel structure is less than the standard predicted value, then the relation type of the parallel structure is determined not to be the target relation type.
[0090] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device 700 includes a processor 710, a memory 720, and a bus 730.
[0091] The memory 720 stores machine-readable instructions executable by the processor 710. When the electronic device 700 is running, the processor 710 and the memory 720 communicate via the bus 730. When the machine-readable instructions are executed by the processor 710, the steps of the parallel structure identification method in the above embodiment can be performed. For specific implementation details, please refer to the method embodiment, which will not be repeated here.
[0092] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run by a processor, it can execute the steps of the above-described parallel structure identification method. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0093] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0097] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0098] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for identifying parallel structures, characterized in that, The method includes: For each text, extract multiple parallel structures from the text. Each parallel structure consists of a first short clause and a second short clause that have a parallel relationship. Identify multiple sets of text information, each set of text information including a parallel structure and the text to which the parallel structure belongs; For each set of text information, the predicted value corresponding to the parallel structure in the set of text information is determined based on the sentence vector and parallel structure vector of the set of text information. The sentence vector is used to represent the semantics of the set of text information, the parallel structure vector is used to represent the semantics of the parallel structure, and the predicted value is used to represent the probability that the relation type of the parallel structure is the target relation type. Based on the predicted value corresponding to each parallel structure, determine the relationship type of each parallel structure; Specifically, multiple parallel structures in each text are extracted using the following method: The text is input into the first parallel structure recognition model to obtain multiple first parallel structures. The first parallel structure recognition model is a parallel structure recognition model built based on standard parallel syntax rules. The text is input into a second parallel structure recognition model to obtain multiple second parallel structures. The second parallel structure recognition model is a parallel structure recognition model constructed based on custom parallel syntax rules under the target technical field. The target technical field is the technical field to which the multiple texts belong. The plurality of first parallel structures and the plurality of second parallel structures are deduplicated; The deduplicated parallel structures are identified as multiple parallel structures extracted from the text.
2. The method according to claim 1, characterized in that, The predicted value for each parallel structure is determined using the following method: For each set of text information, the set of text information is input into a target prediction model to output the predicted value corresponding to the parallel structure in the set of text information. The target prediction model is a model corresponding to the target relation type. The target prediction model performs the following processing: determining the sentence vector and parallel structure vector of the set of text information, and determining the predicted value corresponding to the parallel structure in the set of text information based on the determined sentence vector and parallel structure vector. The prediction model corresponding to the target relation type is obtained through the following methods: Obtain multiple training texts, each of which contains parallel syntax; Extract all parallel structures from each training text; Add a label to each parallel structure, the label indicating the relationship type of the parallel structure; Multiple sets of training information are identified, each set of training information includes a parallel structure and the training text to which the parallel structure belongs; For each set of training information, the initial prediction model is trained using that set of training information to obtain a prediction model corresponding to the target relationship type.
3. The method according to claim 2, characterized in that, The target prediction model includes a bidirectional representation model and a classification model. The predicted value for each parallel structure is generated in the following way: For each set of text information, the set of text information is input into the bidirectional representation model to obtain the sentence vector and parallel structure vector of the set of text information; For each set of text information, the sentence vector and parallel structure vector of the set of text information are input into the classification model to output the predicted value corresponding to the parallel structure in the set of text information.
4. The method according to claim 3, characterized in that, The parallel structure vector of each group of text information is determined in the following way: Identify all the characters corresponding to this set of text information and generate a character vector for each character; Determine all character vectors corresponding to the first and second short sentences in the original sample text of this set of text information; For any one of the first and second short sentences, the mean of all character vectors corresponding to that short sentence is taken as the first short sentence vector or the second short sentence vector; The first and second short sentence vectors are determined as the parallel structure vectors of this group of text information.
5. The method according to claim 4, characterized in that, The classification model includes a contact layer, a fully connected layer, and a normalization layer. For each set of text information, it outputs the predicted value corresponding to the parallel structure in that set of text information in the following manner: The first short sentence vector, sentence vector, and second short sentence vector output by the bidirectional representation model are sequentially input into the contact layer. The contact layer concatenates the input vectors and outputs the concatenated vectors to the fully connected layer. The fully connected layer classifies the input and outputs the classification results to the normalization layer. The normalization layer normalizes the classification results to output the predicted values corresponding to the parallel structures in the text information.
6. The method according to claim 1, characterized in that, For each parallel structure, the relationship type of that parallel structure is determined in the following way: Determine the magnitude of the predicted value and the standard predicted value corresponding to this parallel structure; If the predicted value of the parallel structure is greater than the standard predicted value, then the relation type of the parallel structure is determined to be the target relation type; If the predicted value of the parallel structure is less than the standard predicted value, then the relation type of the parallel structure is determined to be not the target relation type.
7. A recognition device with a parallel structure, characterized in that, The device includes: The extraction module is used to extract multiple parallel structures from each text. Each parallel structure consists of a first clause and a second clause that have a parallel relationship. The multiple parallel structures in each text are extracted in the following way: The text is input into a first parallel structure recognition model to obtain multiple first parallel structures. The first parallel structure recognition model is a parallel structure recognition model constructed based on standard parallel syntax rules. The text is then input into a second parallel structure recognition model to obtain multiple second parallel structures. The second parallel structure recognition model is a parallel structure recognition model constructed based on custom parallel syntax rules in a target technical field, where the target technical field is the technical field to which the multiple texts belong. The multiple first parallel structures and the multiple second parallel structures are then deduplicated. The deduplicated parallel structures are then identified as the multiple parallel structures extracted from the text. The grouping module is used to identify multiple groups of text information, each group of text information including a parallel structure and the text to which the parallel structure belongs; The prediction module is used to determine the predicted value corresponding to the parallel structure in each set of text information based on the sentence vector and parallel structure vector of the set of text information. The sentence vector is used to represent the semantics of the set of text information, the parallel structure vector is used to represent the semantics of the parallel structure, and the predicted value is used to represent the probability that the relation type of the parallel structure is the target relation type. The judgment module is used to determine the relationship type of each parallel structure based on the predicted value corresponding to each parallel structure.
8. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the method for identifying parallel structures as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method for identifying parallel structures as described in any one of claims 1 to 6.