Intention context analysis method and device, electronic equipment and storage medium
By segmenting narrative texts and analyzing their intended context, the problem of low accuracy in analyzing the intended context of narrative texts is solved, resulting in more accurate text evaluation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- IFLYTEK CO LTD
- Filing Date
- 2022-12-26
- Publication Date
- 2026-07-10
AI Technical Summary
The accuracy of intentional context analysis in existing technologies is relatively low, resulting in inaccurate evaluation of the articles.
By segmenting text into segments, identifying semantic and role representations, determining sequential relationships, and employing multi-task joint processing to obtain the intent context, including punctuation filtering, semantic recognition, role type classification, and self-attention learning, the text is effectively processed.
It improves the accuracy of evaluating narrative articles and provides more reliable results for analyzing intent and context, especially suitable for scoring narrative articles.
Smart Images

Figure CN116187336B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to an intent context analysis method, apparatus, electronic device, and storage medium. Background Technology
[0002] Narrative writing is a major genre of composition. Its main task is to describe people and narrate events. The activities of characters and the occurrence of events always follow a certain order of development, including cause, process, and result, and are bound to a specific time and place. Therefore, when writing a narrative, one must grasp the six elements of an event: time, place, characters, cause, process, and result. On the premise of clearly describing these elements, one can make the event vivid and engaging.
[0003] When evaluating narrative texts, the most common approach is to analyze auxiliary features such as text length, word choice, and sentence fluency. However, because the content information contained in the narrative text is not identified and obtained, the accuracy of the evaluation is not high.
[0004] Therefore, to improve the accuracy and reliability of narrative text evaluation, it is necessary to accurately capture the intended meaning and context of the narrative. However, existing narrative text analysis methods are often independent, resulting in relatively low accuracy in identifying the intended meaning and context. Summary of the Invention
[0005] This invention provides an intent context analysis method, apparatus, electronic device, and storage medium to solve the problem of low accuracy in intent context analysis and acquisition in the prior art.
[0006] This invention provides an intent context analysis method, comprising:
[0007] Identify the text to be analyzed, and the summary information of the text;
[0008] The text is segmented into several segments, and the semantic representation of each segment is identified.
[0009] Based on the summary information and the semantic representation of each segment, the role representation of each segment in the text is obtained;
[0010] Based on the semantic representation of each segment and the role representation, the connection relationship between segments is obtained, as well as the intention representation of each segment;
[0011] Based on the aforementioned fragments, character representations, sequential relationships, and intent representations, the contextual analysis results of the text are obtained.
[0012] According to an intent context analysis method provided by the present invention, the step of segmenting the text to obtain several segments includes:
[0013] The punctuation marks in the text are identified, and the identified punctuation marks are used as candidate segmentation points;
[0014] The candidate segmentation points are filtered to obtain the segmentation points for segmenting the text;
[0015] The text is segmented based on the segmentation points to obtain several fragments.
[0016] According to an intent context analysis method provided by the present invention, the step of filtering the candidate segmentation points to obtain segmentation points for segmenting the text includes:
[0017] Semantic recognition is performed on the short sentences obtained based on the punctuation mark intervals, and the recognition results are used as the semantic representation of each segmentation point in the candidate segmentation points;
[0018] A binary classification process is performed based on the semantic representation of each segmentation point to obtain the segmentation label of each segmentation point among the candidate segmentation points, wherein the segmentation label includes segmentation point label and non-segmentation point label.
[0019] The candidate segmentation points are filtered based on the segmentation labels to obtain the segmentation points of the text.
[0020] According to the present invention, an intent context analysis method is provided, wherein obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment includes:
[0021] The summary information is subjected to intent recognition to obtain the corresponding core event vector;
[0022] Based on the core event vector and the semantic representation of each segment, the role representation of each segment is obtained.
[0023] According to the present invention, an intentional context analysis method is provided, wherein obtaining the connection relationship between segments includes:
[0024] Grouping segments, the semantic representation and the role representation are fused to obtain a fused representation;
[0025] The fusion representation is classified to obtain the connection relationships between segments.
[0026] According to the present invention, an intent context analysis method is provided, wherein obtaining the intent representation of each segment includes:
[0027] Grouping by fragments, a comprehensive representation of each fragment is obtained based on the semantic representation and the role representation;
[0028] The comprehensive representation is decoded to obtain the intent representation of each segment.
[0029] According to an intent context analysis method provided by the present invention, obtaining the context analysis result of the text based on the plurality of segments, the role representation, the sequence relationship, and the intent representation includes:
[0030] The character representation is classified to obtain the character type corresponding to the character representation.
[0031] The text's context analysis results are obtained by summarizing the aforementioned fragments, sequential relationships, intention representations, and role types.
[0032] The present invention also provides an intent context analysis device, comprising:
[0033] The information determination module is used to determine the text to be analyzed and the summary information of the text;
[0034] The first processing module is used to segment the text into several segments and identify the semantic representation of each segment.
[0035] The second processing module is used to obtain the role representation of each segment in the text based on the summary information and the semantic representation of each segment;
[0036] The third processing module is used to obtain the connection relationship between segments and the intent representation of each segment based on the semantic representation of each segment and the role representation.
[0037] The summary analysis module is used to obtain the context analysis results of the text based on the aforementioned fragments, the character representations, the sequential relationships, and the character types.
[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above-described intent context analysis methods.
[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the above-described intent context analysis methods.
[0040] The intention context analysis method, apparatus, electronic device, and storage medium provided by this invention, when evaluating articles, analyze and acquire the intention context of the article, and use multi-task joint processing to obtain the role representation and intention representation of each segment in the intention context, and determine the connection relationship between each segment, highlighting the role of each segment in the text and the relationship between each segment. This can more accurately display the intention context of the text, and thus provide a more accurate basis for the evaluation and scoring of the article, especially for the evaluation of narrative articles, with better evaluation accuracy. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0042] Figure 1 This is a flowchart illustrating the intent context analysis method provided by the present invention;
[0043] Figure 2 This is a schematic diagram of the intent context analysis model structure provided by the present invention;
[0044] Figure 3 This is a flowchart illustrating the steps for obtaining several fragments provided by the present invention;
[0045] Figure 4 This is a flowchart illustrating the intent contextualization model provided by the present invention.
[0046] Figure 5 This is another flowchart illustrating the intent contextualization model provided by the present invention;
[0047] Figure 6 This is a schematic diagram of the intent context analysis device provided by the present invention;
[0048] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0050] To address the above problems, embodiments of the present invention provide an intent context analysis method. Figure 1 This is a flowchart illustrating the intent context analysis method provided by the present invention. (Refer to...) Figure 1 The method includes:
[0051] Step 101: Determine the text to be analyzed and its summary information.
[0052] Specifically, the text to be analyzed is a narrative text that requires intent context analysis. When intent context analysis is required, the text to be analyzed is first determined, which is a narrative text. Then, the corresponding intent context is obtained through the analysis of the text. At the same time, when determining the text to be analyzed, the corresponding summary information of the text is also obtained. The summary information is the overview information of the text to be analyzed, such as the essay title and event information in the text.
[0053] For example, text that needs to be analyzed can be represented as ,in Indicates the first Information for each location, which can be text or punctuation marks.
[0054] Meanwhile, after determining the text to be analyzed, the analysis can be performed based on a pre-trained intent context analysis model. Therefore, before processing, an intent context analysis model is obtained through continuous training and optimization. When the narrative text to be analyzed is received, the narrative text is used as input to output the intent context analysis result corresponding to the narrative text.
[0055] Specifically, regarding the intent context analysis model used, based on the characteristics of narrative texts, the model consists of several modules, such as... Figure 2 As shown, the model includes: an encoder module, an atomic fragment module, an intent role recognition module, an intent node relationship recognition module, and an intent extraction module. Through pre-training, a model is obtained that can be used for intent context analysis of narrative text. During training and use, the semantic representation obtained by the encoder module from encoding the text serves not only as input to the atomic fragment module but also as input to the intent role recognition and intent node relationship recognition modules, determining the role representation and sequential relationships corresponding to the fragments.
[0056] For example, in use, the text to be analyzed is input into the model for processing to obtain the corresponding analysis results. Specifically, refer to steps 102 to 104. During the model's actual processing, the encoder module takes the text as input and can pre-select punctuation marks that may serve as segmentation points. These segmentation points are the locations where the text is segmented, and the semantic representation of each punctuation mark is obtained. The atomic segmentation module determines whether the corresponding punctuation mark is used as a segmentation point based on the semantic representation, and completes the text segmentation after determining the segmentation point. The intent role recognition module determines the intent role of each segment based on the text segmentation results. The intent node relationship recognition module determines the type of node relationship between segments, i.e., the succession relationship. The intent extraction module extracts the intent from each segment.
[0057] Step 102: Segment the text to obtain several segments, and identify the semantic representation of each segment.
[0058] When analyzing the intent context of text, which often contains a large number of sentences (i.e., composed of multiple short phrases), it is necessary to pre-segment the text to identify its intent context. This involves dividing the text into multiple segments based on the relationships between the sentences. Specifically, after obtaining the text to be analyzed, it is segmented to obtain several segments. Simultaneously, for each segment, its semantic representation is determined.
[0059] For example, after obtaining the text, it is segmented. When segmenting, it is first necessary to determine how to segment the text, that is, to determine the segmentation points in the text, and then to segment the text into several short sentence fragments. At the same time, each of the several fragments obtained by segmentation needs to have complete intent information.
[0060] For example, if the identified text contains a passage describing "I grabbed the clothes pole and swung it at the dark figure, but upon closer inspection, it turned out to be a trench coat. Thank goodness, it was a false alarm," then when segmenting it, the resulting fragments include "I grabbed the clothes pole and swung it at the dark figure," "Upon closer inspection, it turned out to be a trench coat," and "Thank goodness, it was a false alarm."
[0061] As described above, before segmentation, it is necessary to determine the segmentation points within the text. Only then can the text be segmented at these points to obtain the corresponding fragments. Specifically, refer to... Figure 3 , Figure 3 This is a flowchart illustrating the steps for obtaining several fragments provided by the present invention, wherein the steps include steps 301 to 303.
[0062] Step 301: Recognize the punctuation marks in the text and use the recognized punctuation marks as candidate segmentation points;
[0063] Step 302: Filter the candidate segmentation points to obtain the segmentation points for text segmentation;
[0064] Step 303: Segment the text according to the segmentation points to obtain several segments.
[0065] When segmenting text, each of the resulting segments needs to possess complete semantic and intent information. Therefore, segmentation points are typically selected from punctuation marks within the text. Specifically, when determining the text to be analyzed, punctuation marks are identified and used as candidate segmentation points. These candidate points are then filtered to determine the punctuation marks that can be used as segmentation points, and the text is then segmented based on these determined points.
[0066] For example, in the process of writing an essay or narration, after the end of a paragraph, appropriate punctuation marks are used to separate two adjacent sentences. As described above, a comma "," is used to separate "I grabbed the clothes pole and swung it at the shadow" and "Upon closer inspection" . However, in practice, the two short sentences separated by punctuation marks may or may not be related. For example, "I grabbed the clothes pole and swung it at the shadow" and "Upon closer inspection" are not related in terms of events, while "Upon closer inspection" and "It turned out to be a trench coat" are somewhat related in terms of events. Conversely, "Upon closer inspection" and "It turned out to be a trench coat" are somewhat related in terms of events.
[0067] Therefore, punctuation marks in a text cannot be directly used as dividing points. Appropriate judgments are needed to determine which punctuation marks can be used as dividing points among all punctuation marks.
[0068] Among these, determining the dividing points among the punctuation marks contained in the text includes:
[0069] Semantic recognition is performed on short sentences obtained based on punctuation mark intervals, and the recognition results are used as the semantic representation of each segmentation point in the candidate segmentation points. Binary classification is performed based on the semantic representation of each segmentation point to obtain the segmentation label of each segmentation point in the candidate segmentation points, where the segmentation label includes the segmentation point label and the non-segmentation point label. The candidate segmentation points are filtered based on the segmentation labels to obtain the segmentation points of the text.
[0070] Specifically, when identifying punctuation marks in text to filter and determine segmentation points, semantic recognition is performed on short sentences obtained based on punctuation mark intervals. The recognition results are used as the semantic representations of each segmentation point in the candidate segmentation points. Then, the semantic representations are subjected to binary classification to obtain the corresponding segmentation labels. Finally, all punctuation marks are filtered based on the segmentation labels to obtain the punctuation marks whose segmentation labels are the segmentation point labels as segmentation points.
[0071] For example, in the text, the semantic representation corresponding to each punctuation mark is determined. This semantic representation can be the semantic information of the preceding paragraph. For instance, in the text "I grabbed the clothes pole and slapped it at the dark figure. Upon closer inspection, it turned out to be a trench coat. Thankfully, it was a false alarm.", there are five punctuation marks: four commas and one period. Each punctuation mark has its own corresponding semantic representation. For example, the semantic representation of the first punctuation mark "," can be determined based on "I grabbed the clothes pole and slapped it at the dark figure." The semantic representation of the second punctuation mark "," can be determined based on "Upon closer inspection," and so on, to obtain the semantic representation of all punctuation marks.
[0072] After determining the semantic representation of each punctuation mark, a binary classification judgment is made on whether to perform segmentation in order to determine the segmentation label of each punctuation mark, where the segmentation label includes the segmentation point punctuation and the non-segmentation point label.
[0073] Furthermore, the semantic representation of each tag symbol in the text represents the semantic information of the corresponding sentence, specifically the semantic representation of the sentence preceding the punctuation mark. After the complete text is segmented, the semantic representation of each segment point is the semantic representation of the preceding segment adjacent to that segment point. The text can be encoded when determining the semantic representation.
[0074] Step 103: Based on the summary information and the semantic representation of each segment, obtain the role representation of each segment in the text.
[0075] After segmenting the text according to the determined segmentation points, several fragments are obtained. At this point, the role representation of each fragment in the text is determined. Specifically, the role representation of each fragment is determined based on the pre-obtained summary information. The role representation is a vector or matrix. By processing the role representation, the intent category of each fragment in the text can be obtained. The intent category of a fragment in the text can be set according to the actual situation. That is, the role representation here is used to reflect the intent role that the corresponding fragment plays in the text.
[0076] In practical applications, the role of each fragment can be comprehensively determined based on its semantics and its function within the topic or text. Broadly speaking, fragments can be divided into four categories: setting, event, impact, and others. Each major category can also be further subdivided based on its expressive intent within the text. The specific methods for classifying major and minor categories are as follows:
[0077] 1. Settings: Key settings that trigger changes in the plot.
[0078] Settings - Background: The historical context or current environment in which the event occurred.
[0079] Settings - Time: Determines the development of the event and indicates when the topic will change.
[0080] Settings - Location: Determines the development of events and indicates the location where the topic will change.
[0081] 2. Event-based: At a certain time / place, someone / something did something. This forms the basis of the intentional structure and is generally composed of a subject-predicate phrase.
[0082] Event - Cause: The reason for the occurrence of the event in the entire text, serving to lead into the following text.
[0083] Event-Plan: The overall plan is the protagonist's core subjective intention in writing. Typical trigger words include: we intend, we think, the teacher requires, we do so, etc.
[0084] Event-Intensification: An event that hinders the achievement of the main goal of the article, or contradicts the main goal of the article, and prevents the logical development and progress of the article.
[0085] Event-Resolution: An event that resolves the main contradictions, promotes the achievement of the main goals, or guides the logic in a positive direction.
[0086] Event-Result: The final outcome of the entire event.
[0087] Event - General: General events that cannot be categorized into the above intentional roles.
[0088] 3. Impact Category: The subject's reaction and comments on the event. This includes emotional changes and abstract thinking.
[0089] Impact - Explicit impact: The effect of an event on a subject, including changes in emotions and states.
[0090] Impact-Implication: This includes two categories: implicit impact and inference / speculation. It subtly and implicitly explains the impact of an event on the subject, without directly mentioning it in the original text. Understanding the article's purpose requires inference and speculation.
[0091] Impact-Sublimation: Perspectives and understanding of things, including summaries of events and plans for the future.
[0092] 4. Other categories
[0093] Other: Descriptions, narration, and transitions that cannot be categorized into the above three types.
[0094] In the process of intent context analysis, by identifying the role representations of each segmented fragment, abstract descriptions of event development and emotional changes can be accurately extracted from the text. This allows for a more accurate display of the intent context of the text and facilitates the evaluation and scoring of texts, especially narrative texts.
[0095] The process of determining the role representation of each segment includes: performing intent recognition on the summary information to obtain the corresponding core event vector; and obtaining the role representation of each segment based on the core event vector and the semantic representation of each segment.
[0096] Summary information is a summary of the text, such as the title of an essay. By identifying the summary information, the core event information of the text can be obtained. Then, based on the obtained core events, the role of each segment in the text can be determined.
[0097] Specifically, when determining the role representation of each segment, the intent recognition is first performed on the pre-obtained summary information to obtain the core event vector corresponding to the summary information. At the same time, the implicit information of each segmentation point is determined to obtain the implicit representation of the segmentation point, that is, to determine the semantic representation of each segment. Then, the implicit representation and the core event vector are subjected to vector interaction operation to obtain the role representation corresponding to each segment.
[0098] In addition, after obtaining the role representation, the role type will be classified based on the role representation to determine the role type corresponding to the role representation, so as to generate the corresponding intent context analysis results.
[0099] Step 104: Based on the semantic and role representations of each segment, obtain the connection relationship between segments and the intent representation of each segment.
[0100] Furthermore, after determining the semantic and role representations of each segment, the node relationship type of the segmentation points will be determined, that is, the connection relationship between each segment will be determined. Specifically, the connection relationship between each segment is determined by analyzing the semantic and role representations of each segment, and the intent representation of each segment can also be determined based on the semantic and role representations.
[0101] After segmenting the entire text, except for the first segment, each segment can establish a relationship with another segment based on its own semantic information and its role in the text. This relationship is the expressive purpose of the entire text's layout. The relationship between two segments, that is, the node relationship type of the segmentation point, is as follows:
[0102] 1. Transition: The meaning is opposite or there is a contrast between two segments.
[0103] 2. Cause and effect: One passage explains the cause, argument, or condition, while another passage explains the result or conclusion.
[0104] 3. Purpose: One segment describes a certain behavior, and another segment describes the purpose of the behavior.
[0105] 4. Sequential: The segments are connected in chronological or logical order, without any transitions or cause-and-effect relationships.
[0106] 5. Parallelism: The semantics of the fragments are parallel, there is no dependency relationship, but there is no contextual shift.
[0107] 6. Contains: A fragment is an expanded explanation of another fragment.
[0108] In determining the succession relationship, the process includes: grouping segments and fusing semantic representation with role representation to obtain a fused representation; classifying the fused representation to obtain the node relationship type of the segmentation points for text segmentation.
[0109] For example, when determining the node relationship type, each segment is processed and determined. The segments are grouped together, and the intent representation and role representation corresponding to the segment are fused into vectors to obtain the corresponding fused representation. Then, the relationship type between the current segment and the previous segment, that is, the node relationship type, is determined through self-attention learning.
[0110] When determining the node relationship type between the current segment and the preceding segment, a corresponding node relationship matrix is generated, and then the node relationship type of the current segmentation point is determined based on self-attention processing. It should be noted that when determining the node relationship type between the current segment and the preceding segments, the relationship between the current segment and all preceding segments can be determined.
[0111] In addition, when obtaining the intent representation of each segment, the process includes: grouping segments by segment and obtaining a comprehensive representation of each segment based on semantic and role representations; and decoding the comprehensive representation to obtain the intent representation of each segment.
[0112] For example, when determining the intent information corresponding to each segment, the semantic representation and role representation belonging to the same segment are processed into vectors, such as concatenated, to obtain a comprehensive representation. Then, the obtained comprehensive representation is decoded to obtain the intent representation corresponding to each segment.
[0113] Step 105: Based on several segments, character representations, sequential relationships, and intention representations, obtain the text's context analysis results.
[0114] After segmenting the text and performing subsequent processing to obtain several fragments, the role representations of each fragment, the node relationship types of each segmentation point, and the intent representations of each fragment, the analysis and processing of the text is completed. Specifically, the analysis results of the intent context corresponding to the text are obtained by summarizing and recording several fragments, role representations, node relationship types, and intent representations.
[0115] For example, when summarizing the analysis results of the intent context, the data can be recorded in text or table form, without any specific limitation. Taking a table as an example, the resulting narrative intent context can be shown in Table 1 below.
[0116] Table 1
[0117] Excerpt Role intention succession relationship … … … … As soon as I entered the restroom Event - General (Me) I went into the restroom. … I actually saw a dark shadow. The incident escalated (towards me). I saw a dark shadow. Conform Oh my god, I didn't dare to breathe loudly or make a sound. Impact - Suggestion (Me, Emotions, Negativity) I'm scared. cause and effect I grabbed the clothes pole and swung it at the shadowy figure. Event - General (Me) I #filmed a dark shadow Conform … … … …
[0118] Specifically, when summarizing, the temporal relationship between segments can be recorded, and then the role representation, intent representation, and node relationship type can be matched with the corresponding segments.
[0119] Furthermore, as described above, when analyzing the intent and context of a narrative text, a pre-trained model can be used. For example, this model could be an intent and context analysis model, and its specific structure could be as shown above. Figure 2 As shown, when training the model, the text samples to be trained are determined, and each text sample corresponds to a summary information, and each text sample is marked with segmentation points for segmentation.
[0120] When text samples are input into the model, the encoder encodes the text and recognizes all punctuation marks. However, not all punctuation marks are marked as segmentation points. Instead, the semantic representation of each punctuation mark is obtained, and then the semantic representation is mapped through a fully connected layer to determine the segmentation representation of each punctuation mark. Next, a binary classification is performed to determine whether to perform segmentation, thus obtaining the segmentation label for each punctuation mark. This predicts which punctuation marks will be used as segmentation points and pre-labels the segmentation points of the text. Therefore, the model can be optimized and adjusted based on the results of the binary classification.
[0121] For example, in actual training, when text is used as model input, it is first converted into corresponding vector embeddings. Specifically, the text is represented as... ,in Indicates the first The information at each location can be text or punctuation marks. Based on the text content, the punctuation marks are filtered out. This filtering process is denoted as... ,when When it is a punctuation mark, ,otherwise Then, using positional embedding and word embedding, the text is mapped to two fixed-dimensional position vectors. Information vector of characters In addition, punctuation marks are also included in the embedding, and an additional fixed-dimensional vector is added. This is used to mark the positions of punctuation marks that require special classification. Furthermore, the vector for each character can be represented as:
[0122] .
[0123] Next, pre-trained multilayer... The encoder learns the contextual representation of each word individually. Typical pre-trained encoders include... , , etc., with For example, encoding yields the context representation set for each character. ,in, Indicates the first The character passes through the last layer Implicit representation obtained from unit computation.
[0124] After obtaining the vector representation of the text, during segmentation, a classification layer is first used to perform a non-linear transformation on the latent representation, followed by a binary classification to determine whether to segment. The result of the binary classification determines whether to use the corresponding point as a segmentation point. The binary classification formula is as follows:
[0125] ;
[0126] in, Let be the segmentation point for dividing the text, connecting the two segments before and after it, and denoted as . This is a trainable weight matrix.
[0127] Then, when determining the role representation of each segment, the text samples correspond to core event information, which is predetermined. Through the transformation of the core event information, the core event vector corresponding to the core event information is obtained, denoted as... Simultaneously, the location of segmentation points in the fragment segmentation task is selected. Implicit representation By interacting with the implicit representation and the core event vector, the role representation of each segment can be obtained. Then, through a fully connected layer, the role type of each segment is determined according to the set classification method, where the classification formula is:
[0128] ;
[0129] ;
[0130] in, Let be the segmentation point for dividing the text, and let its corresponding role type be the role type of the adjacent preceding segment. This is a trainable weight matrix.
[0131] Furthermore, the identification of node relationship types relies on the fusion of semantic representation and role representation. The model uses a self-attention mechanism to learn the relationship type between the current node and its predecessor nodes. The calculation process is as follows:
[0132] ;
[0133] ;
[0134] in, The segmentation point is used to divide the text, and its relationship type is the succession relationship between two segments.
[0135] Finally, when obtaining the intent representation of each fragment, the semantic representation and role representation of the fragment are decoded together.
[0136] It should be noted that, based on the analysis process of the intent context of the narrative text, the training of the model can be divided into four different tasks, including: segmentation, role representation determination, node relationship type determination, and intent recognition. Therefore, during the model training process, when determining whether the model training is complete, the loss function of each task is calculated, and then the model's loss function is obtained by summing them up. Furthermore, the various model sub-modules are jointly trained.
[0137] The model obtained based on the above method can be used to analyze the intention and context of narrative texts, obtain more accurate information on the intention and context, and then accurately evaluate the article based on the analysis results.
[0138] For example, when analyzing the intentional context of a narrative text based on the model obtained in the above manner, one can refer to... Figure 4 and Figure 5 , Figure 4 and Figure 5 These are two flowcharts illustrating the model-based intent context analysis method provided by this invention.
[0139] For example, in the process of analyzing and processing text, the document-level text is input into the model trained above, and the encoding layer (RoBERTa) of the model is used for encoding to obtain the semantic representation corresponding to each punctuation mark. Then, the segmentation point is determined in the segmentation classification layer (MLP layer). Based on the semantic representation corresponding to each punctuation mark, the corresponding segmentation representation is obtained through mapping by the fully connected layer. Then, the segmentation representation is classified into two categories to determine the segmentation label corresponding to the segmentation representation, including whether it is a segmentation point or not.
[0140] After determining the segmentation points and completing the text segmentation process at the document level based on the segmentation points, the semantic representation of each segment is determined. The semantic representation of each segment is obtained based on the encoding layer. By determining the segmentation points and the corresponding semantic representations of each segmentation point, it can also be understood as the semantic representation of the segment.
[0141] Then, when determining the role type of each segment, the semantic representation of the core event is introduced, which is the relevant information of the main events recorded in the chapter-level text, such as the representation corresponding to the summary information. The role recognition classification layer (transformer+MLP layer) is used to interact with the semantic representation of each segment to determine the role representation corresponding to each segment. Then, the role type of each segment is determined by classifying the role representation. The categories obtained by classification include four major categories: setting, event, impact and other. Each major category can also be subdivided into multiple subcategories.
[0142] Next, when determining the node relationship type, the role representation and the semantic representation obtained from the aforementioned encoding layer are fused as input to determine whether a node relationship can be formed with other nodes through self-attention learning, and when a node relationship can be formed, the corresponding node relationship type is determined. The node relationship type can be represented in matrix form.
[0143] When determining the intent representation corresponding to each segment, based on Figure 5The described intent extraction subtask is completed by integrating the semantic representation, segmentation representation, and role representation of a fragment. The integrated representation is then decoded by a decoder to obtain the intent representation corresponding to the fragment. The segmentation representation indicates whether a punctuation mark serves as a segmentation point. After segmentation, intent extraction from the segmented fragments is performed by integrating the semantic and role representations of the segmented fragments, followed by subsequent encoding to obtain the intent representation corresponding to the fragment.
[0144] In the method provided by this invention, when evaluating an article, the intentional context of the article is analyzed and obtained. Multi-task joint processing is used to obtain the role representation and intention representation of each segment that needs to be determined in the intentional context, and to determine the connection relationship between each segment, highlighting the role of each segment in the text and the relationship between each segment. This can more accurately display the intentional context of the text, thereby providing a more accurate basis for the evaluation and scoring of the article, especially for the evaluation of narrative articles, which has better evaluation accuracy.
[0145] Based on any of the above embodiments Figure 6 This is a schematic diagram of the intent context analysis device provided by the present invention, as shown below. Figure 6 As shown, the device includes:
[0146] The information determination module 601 is used to determine the text to be analyzed and the text's summary information;
[0147] The first processing module 602 is used to segment the text into several segments and identify the semantic representation of each segment.
[0148] The second processing module 603 is used to obtain the role type of each segment in the text based on the summary information and the semantic representation of each segment;
[0149] The third processing module 604 is used to obtain the connection relationship between segments and the intent representation of each segment based on the semantic representation and role representation of each segment.
[0150] The summary analysis module 605 is used to obtain the text's context analysis results based on several segments, character representations, sequential relationships, and character types.
[0151] The apparatus provided in this invention, when evaluating an article, analyzes and acquires the article's intent structure, employs multi-task joint processing to obtain the role representation and intent representation of each segment that needs to be determined in the intent structure, and determines the sequential relationship between each segment, highlighting the role of each segment in the text and the relationship between each segment. This allows for a more accurate display of the text's intent structure, thereby providing a more accurate basis for article evaluation and scoring, especially for narrative articles, where it has better evaluation accuracy.
[0152] Based on any of the above embodiments, the first processing module 602 is further configured to:
[0153] The text is identified by punctuation marks, and the identified punctuation marks are used as candidate segmentation points.
[0154] The candidate segmentation points are filtered to obtain the segmentation points for text segmentation;
[0155] The text is segmented based on the segmentation points to obtain several fragments.
[0156] Based on any of the above embodiments, the first processing module 602 is further configured to:
[0157] Semantic recognition is performed on short sentences obtained based on punctuation mark intervals, and the recognition results are used as the semantic representation of each segmentation point among the candidate segmentation points;
[0158] Binary classification is performed based on the semantic representation of each segmentation point to obtain the segmentation label of each segmentation point among the candidate segmentation points, where the segmentation label includes the segmentation point label and the non-segmentation point label.
[0159] Candidate segmentation points are filtered based on segmentation labels to obtain the text segmentation points.
[0160] Based on any of the above embodiments, the second processing module 603 is further configured to:
[0161] Intent recognition is performed on the summary information to obtain the corresponding core event vector;
[0162] Based on the core event vector and the semantic representation of each segment, the role representation of each segment is obtained.
[0163] Based on any of the above embodiments, the third processing module 604 is further configured to:
[0164] By grouping segments, semantic representations and role representations are merged to obtain a fused representation;
[0165] The fusion representation is classified to obtain the connection relationship between segments.
[0166] Based on any of the above embodiments, the third processing module 604 is further configured to:
[0167] Grouping by fragments, a comprehensive representation of each fragment is obtained based on semantic and role representations;
[0168] The overall representation is decoded to obtain the intent representation of each segment.
[0169] Based on any of the above embodiments, the summary analysis module 605 is further configured to:
[0170] The roles are categorized based on their representations to obtain the corresponding role types.
[0171] By summarizing several segments, their sequential relationships, intentional expressions, and character types, we can obtain the text's contextual analysis results.
[0172] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7 As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can invoke logical instructions in the memory 730 to execute an intent context analysis method. This method includes: determining the text to be analyzed and its summary information; segmenting the text into several segments and identifying the semantic representation of each segment; obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment; obtaining the connection relationship between segments and the intent representation of each segment based on the semantic representation and role representation of each segment; and obtaining the context analysis result of the text based on the segments, role representation, connection relationship, and intent representation.
[0173] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part 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 the present invention. 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.
[0174] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the intent context analysis method provided by the above methods, the method comprising: determining the text to be analyzed and the summary information of the text; segmenting the text into several segments and identifying the semantic representation of each segment; obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment; obtaining the sequence relationship between the segments and the intent representation of each segment based on the semantic representation and the role representation of each segment; and obtaining the context analysis result of the text based on the several segments, the role representation, the sequence relationship and the intent representation.
[0175] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the aforementioned intent context analysis methods. The method includes: determining the text to be analyzed and the text's summary information; segmenting the text into several segments and identifying the semantic representation of each segment; obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment; obtaining the connection relationship between segments and the intent representation of each segment based on the semantic representation and role representation of each segment; and obtaining the context analysis result of the text based on the several segments, role representation, connection relationship, and intent representation.
[0176] The device embodiments described above are merely illustrative. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0177] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications 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 the present invention.
Claims
1. A method for analyzing intent context, characterized in that, include: Identify the text to be analyzed, and the summary information of the text; The text is segmented into several segments, and the semantic representation of each segment is identified. Based on the summary information and the semantic representation of each segment, the role representation of each segment in the text is obtained; Based on the semantic representation of each segment and the role representation, the connection relationship between segments is obtained, as well as the intention representation of each segment; Based on the aforementioned fragments, character representations, sequential relationships, and intent representations, the text's contextual analysis results are obtained. The step of obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment includes: The summary information is subjected to intent recognition to obtain the corresponding core event vector; Based on the core event vector and the semantic representation of each segment, the role representation of each segment is obtained; The process of obtaining the text's context analysis results based on the aforementioned fragments, character representations, sequential relationships, and intent representations includes: The character representation is classified to obtain the character type corresponding to the character representation. The text's context analysis results are obtained by summarizing the aforementioned fragments, sequential relationships, intention representations, and role types.
2. The intent context analysis method according to claim 1, characterized in that, The process of segmenting the text to obtain several segments includes: The punctuation marks in the text are identified, and the identified punctuation marks are used as candidate segmentation points; The candidate segmentation points are filtered to obtain the segmentation points for segmenting the text; The text is segmented based on the segmentation points to obtain several fragments.
3. The intent context analysis method according to claim 2, characterized in that, The step of filtering the candidate segmentation points to obtain segmentation points for segmenting the text includes: Semantic recognition is performed on the short sentences obtained based on the punctuation mark intervals, and the recognition results are used as the semantic representation of each segmentation point in the candidate segmentation points; A binary classification process is performed based on the semantic representation of each segmentation point to obtain the segmentation label of each segmentation point among the candidate segmentation points, wherein the segmentation label includes segmentation point label and non-segmentation point label. The candidate segmentation points are filtered based on the segmentation labels to obtain the segmentation points of the text.
4. The intent context analysis method according to claim 1, characterized in that, The obtained connection relationships between segments include: Grouping segments, the semantic representation and the role representation are fused to obtain a fused representation; The fusion representation is classified to obtain the connection relationships between segments.
5. The intent context analysis method according to claim 1, characterized in that, The intention representation of each segment obtained includes: Grouping by fragments, a comprehensive representation of each fragment is obtained based on the semantic representation and the role representation; The comprehensive representation is decoded to obtain the intent representation of each segment.
6. An intent context analysis device, characterized in that, include: The information determination module is used to determine the text to be analyzed and the summary information of the text; The first processing module is used to segment the text into several segments and identify the semantic representation of each segment. The second processing module is used to obtain the role representation of each segment in the text based on the summary information and the semantic representation of each segment; The third processing module is used to obtain the connection relationship between segments and the intent representation of each segment based on the semantic representation of each segment and the role representation. The summary analysis module is used to obtain the context analysis results of the text based on the aforementioned fragments, the role representations, the sequential relationships, and the intent representations. The step of obtaining the role representation of each segment in the text based on the summary information and the semantic representation of each segment includes: The summary information is subjected to intent recognition to obtain the corresponding core event vector; Based on the core event vector and the semantic representation of each segment, the role representation of each segment is obtained; The process of obtaining the text's context analysis results based on the aforementioned fragments, character representations, sequential relationships, and intent representations includes: The character representation is classified to obtain the character type corresponding to the character representation. The text's context analysis results are obtained by summarizing the aforementioned fragments, sequential relationships, intention representations, and role types.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the intent context analysis method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the intent context analysis method as described in any one of claims 1 to 5.