Language expression manner identification method and device, electronic equipment and storage medium

CN116029303BActive Publication Date: 2026-09-04IFLYTEK CO LTD +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211691073.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-27
Publication Date
2026-09-04
Estimated Expiration
2042-12-27

AI Technical Summary

Technical Problem

[0005]本发明提供一种语言表达方式识别方法、装置、电子设备和存储介质,用以解决现有技术中每次仅能够识别一类或一种语言表达方式的缺陷

Benefits of technology

[0033]The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the language expression recognition method as described above.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116029303B_ABST
    Figure CN116029303B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and provides a language expression mode recognition method and device, electronic equipment and a storage medium, wherein the method comprises the following steps: determining to-be-recognized text; extracting intra-sentence semantic features and context semantic features of each sub-sentence in the to-be-recognized text, and performing language expression mode recognition on the each sub-sentence based on the intra-sentence semantic features and the context semantic features of the each sub-sentence. The language expression mode recognition method and device, the electronic equipment and the storage medium provided by the application can extract the intra-sentence semantic features and the context semantic features of each sub-sentence in to-be-recognized text, and perform language expression mode recognition on each sub-sentence based on the intra-sentence semantic features and the context semantic features of the each sub-sentence, so that the recognition of multiple language expression modes which depend on context information and only depend on single-sentence information can be simultaneously realized, resource can be saved, and recognition efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device, and storage medium for recognizing language expression patterns. Background Technology

[0002] Language expression refers to the writing methods of an article, which mainly include various methods such as narration, description, expression of emotion, argumentation, explanation, and rhetoric.

[0003] In related technologies, different modeling methods are used for different types of language expressions, and only one type or one language expression can be identified at a time. However, most texts contain multiple language expressions simultaneously, which means that multiple recognitions are required in practical applications, consuming a lot of resources.

[0004] Therefore, providing a method capable of recognizing various linguistic expressions is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for recognizing language expressions, in order to overcome the shortcomings of existing technologies that can only recognize one type or one kind of language expression at a time.

[0006] This invention provides a method for recognizing language expression patterns, comprising:

[0007] Identify the text to be recognized;

[0008] Extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, and identify the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0009] According to the language expression mode recognition method provided by the present invention, the step of recognizing the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause includes:

[0010] Based on the importance of identifying each target language expression mode by the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are fused to obtain the fused semantic features of each clause under each target language expression mode;

[0011] Based on the fusion semantic features of each clause under each target language expression mode, the expression mode of each clause is identified.

[0012] According to the language expression mode recognition method provided by the present invention, the step of fusing the intra-sentence semantic features and contextual semantic features of each clause to determine the importance of the target language expression mode recognition based on the intra-sentence semantic features and contextual semantic features of each clause, and obtaining the fused semantic features of each clause under each target language expression mode, includes:

[0013] Based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to the identification of the target language expression mode, the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause are determined respectively;

[0014] Based on the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are weighted and fused to obtain the fused semantic features of each clause under each target language expression mode.

[0015] According to the language expression recognition method provided by the present invention, the step of extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized includes:

[0016] Based on the correlation between the words in each clause, the contextual semantic features of each word are extracted to obtain the contextual semantic features of each word;

[0017] Based on the contextual semantic features of each word segment, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause;

[0018] Based on the contextual semantic features of each word segment, the contextual semantic features of each clause are extracted to obtain the contextual semantic features of each clause.

[0019] According to the language expression recognition method provided by the present invention, the step of extracting intra-sentence semantic features of each clause based on the contextual semantic features of each word segment to obtain the intra-sentence semantic features of each clause includes:

[0020] Based on the contextual semantic features of each word segment and the importance of each word segment to the recognition of each target language expression mode, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause under each target language expression mode.

[0021] According to the language expression mode recognition method provided by the present invention, the step of extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and performing language expression mode recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause, includes:

[0022] Based on the shared encoding module, the contextual semantic features of each word segment in the text to be identified are extracted;

[0023] Based on the recognition modules corresponding to each target language expression mode, the contextual semantic features of each word segment are applied to extract the sentence semantic features and contextual semantic features of each sentence in the text to be recognized under each target language expression mode. The sentence semantic features and contextual semantic features of each sentence under each target language expression mode are then applied to identify each sentence under each target language expression mode.

[0024] The shared encoding module and the recognition modules corresponding to each target language expression mode constitute a language expression mode recognition model, which is trained based on sample text and labels.

[0025] According to the language expression mode recognition method provided by the present invention, the step of obtaining the language expression mode recognition model includes:

[0026] Obtain an initial model, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression mode;

[0027] Based on the sample text and labels corresponding to each target language expression, the initial model is iterated to obtain the shared encoding module and the intermediate recognition module corresponding to each target language expression;

[0028] Based on the sample text and tags corresponding to each target language expression, the intermediate recognition modules corresponding to each target language expression are iterated to obtain the recognition modules corresponding to each target language expression.

[0029] The present invention also provides a language expression recognition device, comprising:

[0030] The text determination unit is used to determine the text to be recognized;

[0031] The recognition unit is used to extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and to recognize the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0032] 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 program to implement the language expression recognition method as described above.

[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the language expression recognition method as described above.

[0034] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the language expression recognition method as described above.

[0035] The language expression recognition method, device, electronic device, and storage medium provided by this invention extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and perform language expression recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause. This enables the recognition of multiple language expression modes that simultaneously rely on contextual information and those that rely only on information within a single sentence, thereby saving resources and improving recognition efficiency. Attached Figure Description

[0036] 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 introduced 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.

[0037] Figure 1 This is one of the flowcharts illustrating the language expression recognition method provided by the present invention;

[0038] Figure 2 This is the second flowchart of the language expression recognition method provided by the present invention;

[0039] Figure 3 This is the third flowchart of the language expression recognition method provided by the present invention;

[0040] Figure 4 This is the fourth flowchart of the language expression recognition method provided by the present invention;

[0041] Figure 5 This is a flowchart illustrating step 120 of the language expression recognition method provided by the present invention;

[0042] Figure 6 This is a schematic diagram of the structure of the language expression recognition model provided by the present invention;

[0043] Figure 7 This is a schematic diagram of the structure of the recognition modules corresponding to each language expression method provided by the present invention;

[0044] Figure 8This is a schematic diagram illustrating the acquisition process of the language expression recognition model provided by the present invention;

[0045] Figure 9 This is a schematic diagram of the structure of the language expression recognition device provided by the present invention;

[0046] Figure 10 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0047] 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.

[0048] Language expression refers to the writing methods of an article, which mainly include narration, description, expression of emotion, argumentation, explanation, and rhetoric.

[0049] Narration is one of the most common modes of expression in writing, used to describe the experiences of characters and the development and changes of events. Correctly identifying the narrative parts of an article can assist in natural language tasks such as analyzing the event sequence.

[0050] Description involves depicting the appearance and state of the subject, primarily including psychological description, language description, action description, expression description, physical appearance description, environmental description, scene description, and description of the five senses. Descriptive methods use vivid and figurative language to depict the specific characteristics of a character's form, actions, or the state of scenery. In writing, descriptive methods are often used to reveal the characteristics of people or things; therefore, identifying descriptive methods is not only an important indicator of the quality of an article but also helps in identifying the personality and qualities of characters within the text.

[0051] Expression of emotion is the act of conveying and representing the author's feelings, including both direct and indirect expression. The task of identifying expression of emotion is an important prerequisite for sentiment analysis, especially in providing expressive fragments of emotion for analyzing the emotional changes in long texts.

[0052] Argumentation is when an author expresses their views on a particular subject to demonstrate their opinion and attitude. It often employs methods such as theoretical argumentation, exemplification, and comparison. The argumentative texts identified by argumentation recognition tasks are important research subjects for tasks such as opinion mining and argumentation structure analysis.

[0053] Description is a way of expressing information clearly about the shape, nature, characteristics, causes, relationships, and functions of things. Descriptions primarily use methods such as giving examples, listing numbers, making comparisons, and classifying. All relevant information about things in an article is written using these methods. Identifying these methods can effectively help machines determine whether information about things is written in an article and extract that information.

[0054] Rhetorical devices are important means of enhancing the effectiveness of language expression. Using rhetorical devices can make writing more vivid, conveying meaning more effectively, attracting attention, and deepening the reader's impression. Commonly used rhetorical devices include metaphor, personification, hyperbole, parallelism, and quotation. The ability to identify rhetorical devices plays a crucial role in judging the quality of an article. Furthermore, rhetorical devices are also an important means of expressing emotion and are a key basis for identifying the emotional content of an article.

[0055] In related technologies, only one type or one language expression can be identified at a time. Different modeling methods are used for different types of language expressions. The main modeling methods include the following:

[0056] 1) Intra-sentence representation modeling. Rhetorical devices such as metaphor, personification, and hyperbole, and descriptive methods such as appearance, expression, and action, only require consideration of information within the current sentence for identification. Therefore, the identification of these types of language expressions typically employs intra-sentence representation modeling, and component extraction tasks are designed for each method. For example, metaphor recognition uses ontology and vehicle recognition as auxiliary tasks. Intra-sentence representation modeling inputs a single target sentence during recognition, encodes the target sentence using the model to obtain a sentence representation, and classifies the target sentence representation to obtain the target sentence's category. Simultaneously, a relevant component fragment recognition task based on sequence labeling is used for assistance.

[0057] 2) Context-based sentence representation modeling. Indirect expression in lyrical methods, contrastive and causal arguments in argumentative methods, and comparison in explanatory methods all require contextual information for judgment. These types of language expressions cannot be recognized solely based on the current sentence; contextual information is necessary for assessment. Context-based sentence representation modeling takes a contextual fragment containing the target sentence as input during recognition. By using methods such as attention, the target sentence and contextual fragment information interact to obtain a representation of the target sentence. This representation is then classified to determine the category of the target sentence.

[0058] However, in practical applications, most texts contain multiple language expressions, which requires multiple recognitions and consumes a lot of resources.

[0059] Based on this, in order to save resources and achieve the ability to recognize various language expressions with a single input, the inventive concept of this invention is as follows: to perform a unified modeling for various language expressions, to extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and to recognize the language expression of each clause based on the intra-sentence semantic features and contextual semantic features of each clause, thereby achieving the recognition of multiple language expressions that are compatible with both those that rely on contextual information and those that rely only on information within a single sentence.

[0060] Based on the above-mentioned inventive concept, the present invention provides a language expression recognition method, device, electronic device and storage medium, which are applied to language expression recognition scenarios in artificial intelligence technology, such as automatic essay grading scenarios, so as to realize the recognition of various language expressions with a single input, thereby saving resources.

[0061] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings. Figure 1 This is one of the flowcharts illustrating the language expression recognition method provided by the present invention. The execution entity for each step in this method can be a language expression recognition device, which can be implemented through software and / or hardware. This device can be integrated into an electronic device, which can be a terminal device (such as a smartphone, personal computer, wearable device, etc.), a server (such as a local server or cloud server, or a server cluster, etc.), a processor, or a chip, etc. Figure 1 As shown, the method may include the following steps:

[0062] Step 110: Determine the text to be recognized.

[0063] Specifically, the text to be identified is the text that needs to be identified in terms of language expression. The text to be identified can be any form of text, such as a student's essay, a text in a book, an article on the Internet, etc., which will not be listed here.

[0064] The text to be recognized can be directly input by the user, or it can be obtained by transcribing the collected audio, or it can be obtained by capturing images through image acquisition devices such as scanners, mobile phones, and cameras and performing OCR (Optical Character Recognition) on the images, or it can be obtained by transmitting through an interface connected to an external device.

[0065] Step 120: Extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, and identify the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0066] Specifically, after obtaining the text to be recognized, the text can be segmented into sentences to obtain the individual sentences in the text to be recognized.

[0067] The semantic features within each clause can represent the semantic information within that clause, and are usually applied to a single sentence. When identifying certain linguistic expressions, such as rhetorical devices like metaphor, personification, and hyperbole, and descriptive methods like appearance, expression, and action, it is only necessary to consider the semantic features within the current clause.

[0068] For example, the sentence "Sometimes I wear white clothes, sometimes I wear black clothes, and in the morning and evening I put on a red robe" can be identified by extracting and recognizing its semantic features, revealing that it employs the rhetorical device of parallelism.

[0069] The contextual semantic features of each clause can represent the semantic information between each clause and its surrounding context. This is typically applied to sentences containing contextual information, such as paragraphs or entire texts. When identifying certain specific linguistic expressions, such as indirect expression in emotional expression, contrastive and causal argumentation in argumentation, and comparison in explanatory methods, contextual information is required for judgment.

[0070] For example, in the paragraph, "When the sun shines, I turn into vapor. Rising into the sky, I become countless tiny specks, connecting together and floating in the air. Sometimes I wear white clothes, sometimes I wear black clothes, and in the morning and evening I wear a red robe," by combining the information in the surrounding text, we can see that the sentence "Sometimes I wear white clothes, sometimes I wear black clothes, and in the morning and evening I wear a red robe" also uses personification and contrast.

[0071] In practical applications, the semantic features of each sentence in the text to be identified can be obtained by extracting the word embedding vectors of each word in the text to be identified; or the semantic features of each sentence in the text to be identified can be extracted by using a trained feature extraction model; or other existing feature extraction methods can be used to extract the semantic features of each sentence in the text to be identified. This invention does not specifically limit these methods.

[0072] Subsequently, based on the intra-sentence semantic features and contextual semantic features of each clause, the language expression mode of each clause is identified. Specifically, the intra-sentence semantic features and contextual semantic features of each clause can be input into a pre-trained recognition model. The trained model then fuses these features and identifies the language expression mode of each clause based on the fusion result, thus outputting the recognition result for each clause. Alternatively, the intra-sentence semantic features and contextual semantic features of each clause can be applied separately to identify the language expression mode of each clause, and the recognition results obtained based on the intra-sentence semantic features and the contextual semantic features can be combined to determine the language expression mode recognition result for each clause. This embodiment of the invention does not specifically limit this approach.

[0073] The method provided in this invention extracts the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, and identifies the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause. This enables the identification of multiple language expression modes that simultaneously rely on contextual information and those that rely only on information within a single sentence, thereby saving resources and improving recognition efficiency.

[0074] Based on any of the above embodiments Figure 2 This is the second flowchart of the language expression recognition method provided by the present invention, as shown below. Figure 2 As shown, step 120 identifies the language expression style of each clause based on the sentence-level semantic features and contextual semantic features of each clause, specifically including:

[0075] Step 121: Based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to identify each target language expression mode, the intra-sentence semantic features and contextual semantic features of each clause are fused to obtain the fused semantic features of each clause under each target language expression mode;

[0076] Step 122: Based on the fused semantic features of each clause under each target language expression mode, identify each clause under each target language expression mode.

[0077] Specifically, this invention can identify multiple language expressions at once. The target language expressions are those that can be identified using the method of this invention. For example, each target language expression can include narration, description, expression of emotion, and argumentation; each target language expression can also include metaphor, explanation, argumentation, and personification, and can be flexibly set according to actual needs.

[0078] Considering that the contribution of the intra-sentence semantic features and contextual semantic features of each clause to the identification of each target language expression mode is different, the usefulness of the features is different, that is, the intra-sentence semantic features and contextual semantic features of each clause are of different importance to the identification of each target language expression mode.

[0079] Therefore, the importance of each target language expression can be determined based on the semantic features within each clause and the semantic features of the context, and then the semantic features within the clause and the semantic features of the context can be fused to obtain fused semantic features. In the fused semantic features, the semantic features that are of higher importance to the identification of the target language expression can be emphasized, while the semantic features that are of lower importance to the identification of the target language expression can be weakened accordingly.

[0080] Taking lyrical expression as an example, the correlation between contextual semantic features and lyrical expression is relatively strong, contributing significantly to the identification of lyrical expression. Conversely, the correlation between sentence-level semantic features and lyrical expression is relatively weak, contributing less to the identification of lyrical expression. Therefore, fusing sentence-level semantic features and contextual semantic features of each clause can strengthen the contextual semantic features of each clause and weaken the sentence-level semantic features of each clause, thereby further improving the accuracy of identification.

[0081] For example, suppose one of the target language expressions is a metaphor, a rhetorical device. The correlation between contextual semantic features and the metaphorical expression is relatively small, contributing little to the identification of the metaphorical expression. Conversely, the correlation between sentence-level semantic features and the metaphorical expression is relatively large, contributing significantly to the identification of the metaphorical expression. Therefore, when fusing the sentence-level semantic features and contextual semantic features of each clause, the sentence-level semantic features of each clause can be strengthened, while the contextual semantic features of each clause can be weakened.

[0082] After fusing the intra-sentence semantic features and contextual semantic features of each clause, the resulting fused semantic features can be used to identify various target language expressions. Specifically, pre-trained classifiers corresponding to each target language expression can be used to classify the fused semantic features.

[0083] The method provided in this invention fuses semantic features within a sentence and semantic features from the context, and identifies various target language expressions based on the fused semantic features. The fused semantic features strengthen the semantic features that are closely related to the identification of various target language expressions, and weaken the semantic features that are less related to the identification of various target language expressions, which helps to further improve the accuracy of identification.

[0084] Based on any of the above embodiments Figure 3This is the third flowchart of the language expression recognition method provided by the present invention, as shown below. Figure 3 As shown, step 121 specifically includes:

[0085] Step 121-1: Based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to the identification of the target language expression mode, determine the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause respectively;

[0086] Step 121-2: Based on the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are weighted and fused to obtain the fused semantic features of each clause.

[0087] Specifically, we can first determine the importance of each clause in identifying the target language expression based on its intra-sentence semantic features and contextual semantic features. In determining this importance, we can pre-learn the mapping relationship between intra-sentence semantic features and contextual semantic features and the identification of the target language expression through training. In subsequent applications, we can directly substitute the current intra-sentence semantic features and contextual semantic features into the mapping relationship to obtain the importance of each clause's intra-sentence semantic features and contextual semantic features in identifying the target language expression.

[0088] Based on this, the importance can be directly used as the corresponding fusion weight, or after obtaining the importance of the intra-sentence semantic features and contextual semantic features of each clause for the identification of the target language expression mode, the corresponding importance is normalized to obtain the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features respectively. This embodiment of the invention does not make specific limitations on this.

[0089] Subsequently, the semantic features within the sentence and the semantic features of the context of each clause can be fused by weighted fusion. Here, weighted fusion can be weighted summation, weighted summation followed by averaging, or the semantic features within the sentence and the semantic features of the context can be multiplied by their respective weights and then concatenated. This embodiment of the invention does not impose specific limitations on this.

[0090] The method provided in this invention identifies various target language expressions by assigning different weights to the semantic features within sentences and the semantic features of the context of each clause and then fusing them together. The resulting fused semantic features can further improve the accuracy of identification.

[0091] Based on any of the above embodiments, the fusion and identification process can be represented as follows:

[0092]

[0093]

[0094] Where w inner and w context These represent the relative importance of intra-sentence semantic features and contextual semantic features for identifying target language expression patterns. and These represent the weights of the intra-sentence semantic features and the contextual semantic features after normalization using softmax, respectively. k To integrate semantic features for the identification of target language expressions. inner and w context The training process can learn the different contributions of intra-sentence semantic features and contextual semantic features to the recognition task of each language expression mode.

[0095] Finally, a linear classification layer can be used to classify the target language expressions, obtaining the sentence's label in the target language expression Y = (y1, y2, ..., y3). m The system identifies whether an expression is used in the target language, as shown in the following formula:

[0096] y k =linear-classifier(s k )

[0097] For example, if the target language expression modes are narration, expression of emotion, argumentation, and description, and the identified sentence's label in terms of the target language expression mode is Y = (yes, no, yes, no), then the text to be identified includes two language expression modes: narration and argumentation.

[0098] Understandably, this method can be used to identify multiple target language expressions simultaneously.

[0099] Based on any of the above embodiments Figure 4 This is the fourth flowchart of the language expression recognition method provided by the present invention, as shown below. Figure 4 As shown, step 120 extracts the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, including:

[0100] Step 123: Based on the correlation between the words in each clause, extract the contextual semantic features of each word to obtain the contextual semantic features of each word.

[0101] Step 124: Based on the contextual semantic features of each word segment, extract the sentence semantic features of each clause to obtain the sentence semantic features of each clause;

[0102] Step 125: Based on the contextual semantic features of each word segment, extract the contextual semantic features of each clause to obtain the contextual semantic features of each clause.

[0103] Specifically, in order to extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, we can first extract the contextual semantic features of each word in the text to be identified, thus obtaining the semantic information representation of each word in the context, i.e., the contextual semantic features of each word. Based on the correlation between the words in each clause, extracting the contextual semantic features of each word ensures that each word can take into account the information of all words in the text to be identified during feature extraction.

[0104] The contextual semantic features of each word segment can be obtained in the following way:

[0105] In one example, "[CLS]" and "[SEP]" are added before and after each sentence in the text to be recognized, respectively, as semantic feature extraction and sentence boundary indication. For example, the original input paragraph contains three sentences: "strolling in the park...", "green trees...", and "so happy...". After adding the tags, the input is transformed into "[CLS]strolling in the park...[SEP][CLS]green trees...[SEP][CLS]so happy...[SEP]". Then, the words and tags in the transformed sentences are encoded into vector representations using word embedding, that is, the text to be recognized can be represented as a word vector sequence X = (x1, x2, ..., x...). n ), where x i This represents the word vector corresponding to the i-th word.

[0106] Then, based on the feature extraction model of the self-attention mechanism, the contextual semantic features of each word can be extracted to obtain the contextual semantic features of each word.

[0107] Based on this, steps 124 and 125 can be executed. It should be noted that steps 124 and 125 can be executed simultaneously or sequentially, and there is no restriction on the order of execution.

[0108] To address the semantic features within each clause, we can extract the semantic features within each clause by considering the contextual semantic features of each word in the clause. This will give us the intra-sentence information representation of each clause, i.e., the intra-sentence semantic features.

[0109] Based on the contextual semantic features of each clause, the sentence-to-sentence interaction can be performed on each clause according to the contextual semantic features of each word in each clause, so as to extract the contextual semantic features and obtain the contextual information representation of each clause, i.e., the contextual semantic features.

[0110] The method provided in this invention extracts the sentence semantic features and the context semantic features of each clause based on the context semantic features of each word segment. This allows the context semantic features of each word segment to be shared during feature extraction, thereby saving resources and improving feature extraction efficiency.

[0111] Based on any of the above embodiments, step 124 specifically includes:

[0112] Step 124-1: Based on the contextual semantic features of each word segment and the importance of each word segment in identifying the target language expression mode, extract the sentence semantic features of each clause to obtain the sentence semantic features of each clause.

[0113] Specifically, considering that the contribution of the contextual semantic features of each word to the recognition of each target language expression mode is different, the usefulness of the features is different, that is, the importance of the contextual semantic features of words to the recognition of each target language expression mode is different.

[0114] Therefore, the semantic features within each clause can be extracted based on the contextual semantic features of each word and the importance of each word in identifying the target language expression. During feature extraction, word features that are more important in identifying the target language expression can be emphasized, while word features that are less important can be de-emphasized.

[0115] For example, in the sentence "Her face is like an apple," the word segment "like" is of high importance in identifying the rhetorical device of metaphor. When extracting features, we can focus on reflecting the contextual semantic features of the word segment "like."

[0116] In some embodiments, the importance of the contextual semantic features of each word in the sentence to the current language expression can be calculated using a local attention method. Then, the semantic features within the sentence can be obtained by weighted summation of the word vectors in the sentence. iner ,Right now:

[0117]

[0118]

[0119] in, These are contextual semantic features used to calculate the importance of each word segment to the target language expression. For the word vector sequence of the k-th sentence, that is, from the m-th sentence... k The word to the nth k A sequence of word vectors for m words. k and n kThese are the positions of the start label "[CLS]" and the end label "[SEP]" of the k-th sentence in the input sequence, respectively. k This represents the importance of each word in the sentence to the expression of the target language. represents the importance weight of the i-th word in the sentence. for The vector representation of the i-th word in the text. Let be the semantic features within the sentence of sentence k.

[0120] Based on any of the above embodiments Figure 5 This is a flowchart illustrating step 120 of the language expression recognition method provided by the present invention, as shown below. Figure 5 As shown, step 120 specifically includes:

[0121] Step 126: Based on the shared encoding module, extract the contextual semantic features of each word segment in the text to be identified;

[0122] Step 127: Based on the recognition modules corresponding to each target language expression mode, apply the contextual semantic features of each word segment to extract the sentence semantic features and contextual semantic features of each sentence in the text to be recognized under each target language expression mode, and apply the sentence semantic features and contextual semantic features of each sentence under each target language expression mode to recognize each sentence under each target language expression mode.

[0123] The shared encoding module and the recognition modules corresponding to each target language expression mode constitute the language expression mode recognition model, which is trained based on sample text and labels.

[0124] Specifically, in order to recognize multiple language expressions at once, a language expression recognition model can be used. Figure 6 This is a schematic diagram of the structure of the language expression recognition model provided by the present invention, as shown below. Figure 6 As shown, the language expression mode recognition model includes a shared encoding module and recognition modules corresponding to each target language expression mode. For example, narrative expression mode can correspond to recognition module 1, argumentative expression mode can correspond to recognition module 2, rhetorical expression mode can correspond to recognition module 3, ..., descriptive expression mode can correspond to recognition module N, etc. The recognition modules corresponding to each target language expression mode output their respective language expression mode labels, which indicate whether it is that language expression mode.

[0125] The shared encoding module can be used to extract the contextual semantic features of each word segment in the text to be recognized. The shared encoding module can employ the BERT model. The BERT model uses a multi-layer self-attention-based Transformer structure, where each word can pay attention to the information of all input words during encoding. This structure makes the output word vectors context-based, i.e.:

[0126] H = BERT(X)

[0127] The final result is H = (h1, h2, ..., h n ) represents the word representation sequence output by the last layer of the BERT model. Where X is the input text to be recognized; h i This represents the semantic information of the i-th word in the input within its context, i.e., the contextual semantic features of each word segment. This information representation is shared by all subsequent language expression recognition methods.

[0128] Each target language expression's corresponding recognition module simultaneously extracts intra-sentence semantic features and contextual semantic features. These two types of features are then fused to obtain the language expression sentence representation, i.e., semantic feature fusion. Finally, the language expression sentence representation is classified. Since each language expression focuses on different information, each language expression uses a separate language expression recognition module. Figure 7 This is a schematic diagram of the structure of the recognition modules corresponding to each language expression method provided by the present invention, such as... Figure 7 As shown, the recognition modules corresponding to each language expression mode include a sentence semantic feature extraction submodule, a context semantic feature extraction submodule, a fusion submodule, and a recognition submodule.

[0129] Among them, the sentence semantic feature extraction submodule is used to extract the sentence semantic features of each clause in the text to be identified under each target language expression mode;

[0130] The contextual semantic feature extraction submodule is used to extract the contextual semantic features of each clause in the text to be identified under each target language expression.

[0131] The fusion submodule is used to fuse the intra-sentence semantic features and contextual semantic features of each clause under different target language expressions to obtain fused semantic features. The fusion submodule can be implemented using a gating module.

[0132] The recognition submodule is used to identify the target language expression mode of each sentence based on the fused semantic features. The feature extraction and recognition process can be referred to the description in the foregoing embodiments, and will not be repeated here.

[0133] The method provided in this invention uses a language expression recognition model to uniformly model various language expression recognition tasks, enabling the recognition of all language expressions using a single model.

[0134] Based on any of the above embodiments Figure 8 This is a schematic diagram of the acquisition process of the language expression recognition model provided by the present invention, as shown below. Figure 8 As shown, the steps for obtaining the language expression recognition model include:

[0135] Step 810: Obtain the initial model, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression.

[0136] Step 820: Based on the sample text and labels corresponding to each target language expression, perform parameter iteration on the initial model to obtain the shared encoding module and the intermediate recognition module corresponding to each target language expression.

[0137] Step 830: Based on the sample text and labels corresponding to each target language expression, perform parameter iteration on the intermediate recognition modules corresponding to each target language expression to obtain the recognition modules corresponding to each target language expression.

[0138] Specifically, to obtain a language expression recognition model, an initial model is first acquired, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression. Based on the initial model, parameters are iterated using a training dataset. After parameter iteration, the language expression recognition model is obtained.

[0139] Given that existing technical solutions only use labeled datasets of target language expressions during training and cannot use large-scale data, the existing solutions lack scalability and cannot quickly add recognition of a new language expression without affecting the recognition capability of existing language expressions.

[0140] Furthermore, because the recognition tasks for different language expressions are conducted separately, the resulting datasets only contain annotations for one or a subset of language expressions. This makes it difficult to integrate these datasets to train a model.

[0141] Based on this, in order to enhance the utilization of data and reduce the problem of asynchronous convergence of different tasks in multi-task learning, the embodiments of the present invention adopt a two-stage training method during training.

[0142] In the first stage of training, large-scale training is performed using the available training data. Based on the sample texts and labels corresponding to each target language expression, the parameters of the initial model are iterated to obtain a shared encoding module and intermediate recognition modules corresponding to each target language expression.

[0143] Because existing technologies perform language expression recognition tasks separately, different datasets only label a portion of the language expressions. To train all language expression tasks using large-scale data, all datasets are pooled for training. During training, the data from each dataset is differentiated and optimized only on the language expression task it is labeled with. This expands the training data scale and ensures that each language expression task is trained.

[0144] In the second training phase, the module parameters of the shared encoding module are fixed. Based on the sample text and labels corresponding to each target language expression, the parameters of the intermediate recognition modules corresponding to each target language expression are iterated to obtain the recognition modules corresponding to each target language expression. The private recognition module for each language expression is then optimized using the labeled data of each language expression in turn. This can solve the problems of asynchronous convergence rates and imbalanced training data for different language expression tasks in the first phase.

[0145] It should be noted that when it is necessary to add the ability to recognize new language expressions, it is only necessary to add a new language expression recognition module, and then conduct a second stage of training for the new language expression.

[0146] The method provided in this invention first trains the model with large-scale labeled data of different language expressions in the first stage to achieve good generalization performance. Then, in the second stage, the module parameters of the shared encoding module are fixed, and the target language expression data is used to specifically optimize the target language expression. Furthermore, since the training with large-scale language expression data gives the shared encoding module good generalization, when adding new language expression recognition, only a new recognition module needs to be added at the top level, and the new language expression recognition module needs to be optimized.

[0147] Based on any of the above embodiments, a method for recognizing language expression patterns is provided, including:

[0148] S1. Construct the initial model, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression.

[0149] S2, based on the sample text and labels corresponding to each target language expression, iterates the parameters of the initial model to obtain a shared encoding module and intermediate recognition modules corresponding to each target language expression. Large-scale language expression labeled corpora are used, and all language expression recognition tasks are trained simultaneously through a multi-task learning method, making full use of the data while allowing the various language expression recognition tasks to assist each other.

[0150] S3, based on the sample text and labels corresponding to each target language expression, performs parameter iteration on the intermediate recognition modules corresponding to each target language expression to obtain the recognition modules corresponding to each target language expression.

[0151] By fixing the parameters of the shared encoding module, the model is trained in two stages using labeled corpora for each representation. This alleviates the problem of asynchronous convergence of different tasks during multi-task training.

[0152] S4, the shared encoding module, and the recognition modules corresponding to each target language expression mode constitute the language expression mode recognition model.

[0153] S5, determine the text to be recognized.

[0154] S6. Based on the shared encoding module, extract the contextual semantic features of each word in the text to be identified; based on the recognition modules corresponding to each target language expression mode, apply the contextual semantic features of each word to extract the sentence-level semantic features and contextual semantic features of each clause in the text to be identified under each target language expression mode, and apply the sentence-level semantic features and contextual semantic features of each clause under each target language expression mode to identify each clause under each target language expression mode.

[0155] In S6, the sentence-level semantic features and contextual semantic features of each clause under each target language expression mode are applied to identify each clause under each target language expression mode, including:

[0156] S61, based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to the identification of the target language expression mode, determine the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause respectively;

[0157] S62, based on the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are weighted and fused to obtain the fused semantic features of each clause under each target language expression mode;

[0158] S63, based on the fusion semantic features of each clause under each target language expression mode, identify each clause under each target language expression mode.

[0159] The method provided in this invention is compatible with the recognition of multiple language expressions that rely on both contextual information and information within a single sentence. A single model can recognize multiple language expressions at once, and the ability to quickly add new language expression recognition capabilities to the original model can be rapidly expanded, enabling rapid expansion of the model's recognition capabilities.

[0160] The language expression recognition device provided by the present invention is described below. The language expression recognition device described below can be referred to in correspondence with the language expression recognition method described above.

[0161] Based on any of the above embodiments Figure 9 This is a schematic diagram of the language expression recognition device provided by the present invention, as shown below. Figure 9 As shown, the language expression recognition device includes a text determination unit 910 and a recognition unit 920, wherein:

[0162] The text determination unit 910 is used to determine the text to be recognized;

[0163] The recognition unit 920 is used to extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and to recognize the language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0164] The language expression recognition device provided in this embodiment of the invention extracts the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and performs language expression recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause. This enables the recognition of multiple language expression modes that simultaneously rely on contextual information and those that rely only on information within a single sentence, thereby saving resources and improving recognition efficiency.

[0165] Based on any of the above embodiments, the identification unit is specifically used for:

[0166] Based on the importance of identifying each target language expression mode according to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are fused to obtain the fused semantic features of each clause;

[0167] Based on the fused semantic features of each clause, the target language expression mode of each clause is identified.

[0168] Based on any of the above embodiments, the identification unit is specifically used for:

[0169] Based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to the identification of the target language expression mode, the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause are determined respectively;

[0170] Based on the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are weighted and fused to obtain the fused semantic features of each clause.

[0171] Based on any of the above embodiments, the identification unit is specifically used for:

[0172] Based on the correlation between the words in each clause, the contextual semantic features of each word are extracted to obtain the contextual semantic features of each word;

[0173] Based on the contextual semantic features of each word segment, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause;

[0174] Based on the contextual semantic features of each word segment, the contextual semantic features of each clause are extracted to obtain the contextual semantic features of each clause.

[0175] Based on any of the above embodiments, the identification unit is specifically used for:

[0176] Based on the contextual semantic features of each word segment and the importance of each word segment in identifying the target language expression mode, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause.

[0177] Based on any of the above embodiments, the identification unit is specifically used for:

[0178] Based on the shared encoding module, the contextual semantic features of each word segment in the text to be identified are extracted;

[0179] Based on the recognition modules corresponding to each target language expression mode, the contextual semantic features of each word segment are applied to extract the sentence semantic features and contextual semantic features of each sentence in the text to be recognized under each target language expression mode. The sentence semantic features and contextual semantic features of each sentence under each target language expression mode are then applied to identify each sentence under each target language expression mode.

[0180] The shared encoding module and the recognition modules corresponding to each target language expression mode constitute a language expression mode recognition model, which is trained based on sample text and labels.

[0181] Based on any of the above embodiments, the recognition device further includes a model acquisition unit, specifically used for:

[0182] Obtain an initial model, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression mode;

[0183] Based on the sample text and labels corresponding to each target language expression, the initial model is iterated to obtain the shared encoding module and the intermediate recognition module corresponding to each target language expression;

[0184] Based on the sample text and tags corresponding to each target language expression, the intermediate recognition modules corresponding to each target language expression are iterated to obtain the recognition modules corresponding to each target language expression.

[0185] Figure 10 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 10 As shown, the electronic device may include a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040. The processor 1010, communications interface 1020, and memory 1030 communicate with each other via the communication bus 1040. The processor 1010 can call logical instructions in the memory 1030 to execute a language expression recognition method. This method includes: determining the text to be recognized; extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized; and performing language expression recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0186] Furthermore, the logical instructions in the aforementioned memory 1030 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, 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.

[0187] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the language expression recognition method provided by the above methods. The method includes: determining the text to be recognized; extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized; and performing language expression recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0188] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When executed by a processor, the computer program implements the language expression mode recognition method provided by the above methods. The method includes: determining the text to be recognized; extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized; and performing language expression mode recognition on each clause based on the intra-sentence semantic features and contextual semantic features of each clause.

[0189] 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.

[0190] 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.

[0191] 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 recognizing language expression patterns, characterized in that, include: Identify the text to be recognized; The sentence-level semantic features and contextual semantic features of each clause in the text to be identified are extracted. Based on the sentence-level semantic features and contextual semantic features of each clause, the importance of each target language expression mode is identified. The target language expression modes of each clause are then identified. The contextual semantic features represent the semantic information between the clause and the context of the paragraph or chapter in which it is located. Each target language expression mode includes at least one language expression mode that relies only on information within a single sentence and at least one language expression mode that relies on contextual information.

2. The language expression recognition method according to claim 1, characterized in that, The method of identifying the importance of each target language expression mode based on the intra-sentence semantic features and contextual semantic features of each clause, and then identifying the target language expression mode of each clause, includes: Based on the importance of identifying each target language expression mode by the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are fused to obtain the fused semantic features of each clause under each target language expression mode; Based on the fusion semantic features of each clause under each target language expression mode, the expression mode of each clause is identified.

3. The language expression mode recognition method according to claim 2, characterized in that, The method involves fusing the semantic features of each clause with the intra-sentence semantic features and contextual semantic features to determine the importance of the target language expression, thereby obtaining the fused semantic features of each clause under each target language expression. This fusion includes: Based on the importance of the intra-sentence semantic features and contextual semantic features of each clause to the identification of the target language expression mode, the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause are determined respectively; Based on the fusion weights corresponding to the intra-sentence semantic features and contextual semantic features of each clause, the intra-sentence semantic features and contextual semantic features of each clause are weighted and fused to obtain the fused semantic features of each clause under each target language expression mode.

4. The language expression mode recognition method according to claim 1, characterized in that, The extraction of intra-sentence semantic features and contextual semantic features from each clause in the text to be identified includes: Based on the correlation between the words in each clause, the contextual semantic features of each word are extracted to obtain the contextual semantic features of each word; Based on the contextual semantic features of each word segment, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause; Based on the contextual semantic features of each word segment, the contextual semantic features of each clause are extracted to obtain the contextual semantic features of each clause.

5. The language expression recognition method according to claim 4, characterized in that, Based on the contextual semantic features of each word segment, the sentence-level semantic features of each clause are extracted to obtain the sentence-level semantic features of each clause, including: Based on the contextual semantic features of each word segment and the importance of each word segment to the recognition of each target language expression mode, the sentence semantic features of each clause are extracted to obtain the sentence semantic features of each clause under each target language expression mode.

6. The language expression recognition method according to any one of claims 1 to 5, characterized in that, The step of extracting the intra-sentence semantic features and contextual semantic features of each clause in the text to be identified, and identifying the target language expression mode of each clause based on the importance of the intra-sentence semantic features and contextual semantic features of each clause, includes: Based on the shared encoding module, the contextual semantic features of each word segment in the text to be identified are extracted; Based on the recognition modules corresponding to each target language expression mode, the contextual semantic features of each word segment are applied to extract the sentence semantic features and contextual semantic features of each sentence in the text to be recognized under each target language expression mode. The sentence semantic features and contextual semantic features of each sentence under each target language expression mode are then applied to identify each sentence under each target language expression mode. The shared encoding module and the recognition modules corresponding to each target language expression mode constitute a language expression mode recognition model, which is trained based on sample text and labels.

7. The language expression mode recognition method according to claim 6, characterized in that, The steps for obtaining the language expression recognition model include: Obtain an initial model, which includes an initial shared encoding module and initial recognition modules corresponding to each target language expression mode; Based on the sample text and labels corresponding to each target language expression, the initial model is iterated to obtain the shared encoding module and the intermediate recognition module corresponding to each target language expression; Based on the sample text and tags corresponding to each target language expression, the intermediate recognition modules corresponding to each target language expression are iterated to obtain the recognition modules corresponding to each target language expression.

8. A language expression recognition device, characterized in that, include: The text determination unit is used to determine the text to be recognized; The recognition unit is used to extract the intra-sentence semantic features and contextual semantic features of each clause in the text to be recognized, and to identify the target language expression mode of each clause based on the intra-sentence semantic features and contextual semantic features of each clause. The contextual semantic features represent the semantic information between the clause and the context of the paragraph or chapter in which it is located. The target language expression mode includes at least one language expression mode that relies only on information within a single sentence and at least one language expression mode that relies on contextual information.

9. 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 language expression recognition method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the language expression recognition method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Text emotion classification method and device, electronic device and readable storage medium

    CN110222178A

  • Dialogue emotion style prediction method and device, electronic equipment and storage medium

    CN112270168A

  • Sentiment classification method and device, storage medium and computer equipment

    CN113449110A

  • Chiffon recognition model based on convolutional neural network and attention mechanism

    CN114722798A