Text feature extraction method, system and equipment based on script killing scene and medium

By using preprocessing, feature extraction network and N-pairs loss function methods in script kill text processing, the problems of poor processing efficiency, accuracy and adaptability in the prior art are solved, and more efficient and accurate text feature extraction is achieved, and the application performance is improved.

CN119808758APending Publication Date: 2025-04-11湖南芒果融创科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411883531.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently process and understand the content of script killing text, resulting in poor processing efficiency, accuracy and adaptability in applications such as script recommendation systems and automatic plot analysis auxiliary tools.

Method used

A text feature extraction method based on script kill scenes is adopted to reorder text sequences through preprocessing steps, and combine feature extraction networks (including exception modules and Transformer modules) and N-pairs loss function to perform end-to-end training and reasoning.

Benefits of technology

It improves the efficiency and accuracy of text processing, enhances the model's understanding of script killing text, and improves the application's adaptability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808758A_ABST
    Figure CN119808758A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text feature extraction method, system and device based on a script killing scene and a medium, and belongs to the technical field of data processing, and the method specifically comprises the steps that 1, text paragraphs in a script killing sample data set are obtained, data processing operation is conducted on the text paragraphs through a preprocessing method based on a script killing text format, and the text paragraphs in the script killing sample data set are obtained; obtaining a reordered text sequence; 2, inputting the text sequence into a feature extraction network to obtain feature representation; step 3, substituting a label corresponding to the feature representation and the text sequence into an N-pair loss function to train a feature extraction network; and 4, performing data processing operation on a target text, and inputting the target text into the trained feature extraction network to obtain a feature extraction result. Through the scheme disclosed by the invention, the processing efficiency, the accuracy and the adaptability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The disclosed embodiments relate to the field of data processing technology, and in particular to a method, system, device and medium for extracting text features based on a script-killing scenario. Background Art

[0002] At present, with the diversification of people's entertainment needs, script-killing has quickly become popular as a social reasoning game. In the process of script-killing games, a large amount of text information is involved, including script plots, character descriptions, clue texts, etc. However, there is currently a lack of technical means for efficient feature extraction based on the characteristics of script-killing texts. Traditional text feature extraction methods often do not take into account the unique structure and semantic characteristics of script-killing texts, such as the complex relationship network between characters, the multi-threaded interweaving of plots, and reasoning-oriented text expressions. This makes it difficult to accurately process and understand text content in the development of script-killing related applications, such as script recommendation systems and automatic plot analysis auxiliary tools, thus affecting user experience and application effectiveness.

[0003] It can be seen that there is an urgent need for a text feature extraction method based on script-killing scenarios with high processing efficiency, accuracy and adaptability. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a text feature extraction method, system, device and medium based on a script-killing scenario, which at least partially solves the problems of poor processing efficiency, accuracy and adaptability in the prior art.

[0005] In a first aspect, the present disclosure provides a method for extracting text features based on a script-killing scenario, including:

[0006] Step 1, obtain the text paragraphs in the script-killing sample data set, perform data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtain a reordered text sequence;

[0007] Step 2: Input the text sequence into the feature extraction network to obtain feature representation;

[0008] Step 3: Substitute the labels corresponding to the feature representation and text sequence into the N-pairs loss function to train the feature extraction network;

[0009] Step 4: After performing data processing operations on the target text, input the trained feature extraction network to obtain the feature extraction result.

[0010] According to a specific implementation of the embodiment of the present disclosure, step 1 specifically includes:

[0011] Step 1.1, removing noise data in the text paragraph, wherein the noise data includes redundant blank characters and special symbols;

[0012] Step 1.2, use the Jieba word segmentation tool to perform word serialization operations on the text paragraph to obtain the initial text sequence;

[0013] Step 1.3, establish the topic model LDA-latent Dirichlet allocation to identify the topic words in the initial text sequence, and perform reordering and splicing operations to obtain the reordered text sequence.

[0014] According to a specific implementation of the embodiment of the present disclosure, the subject words include protagonist, supporting role, narration, scene and action expression.

[0015] According to a specific implementation of an embodiment of the present disclosure, the feature extraction network includes a xception module and a Transformer module.

[0016] According to a specific implementation of an embodiment of the present disclosure, the xception module includes multiple convolution kernels of different sizes, and the Transformer module includes multi-head attention, a feedforward neural network and a normalization layer.

[0017] According to a specific implementation of the embodiment of the present disclosure, step 2 specifically includes:

[0018] Step 2.1, the text sequence is divided into three parts: part of speech, semantic theme, and number of phrases to form an input matrix;

[0019] Step 2.2, use 1*1 convolution kernel to perform preliminary dimension adjustment and feature integration on the text features of the input matrix;

[0020] Step 2.3, use a 5*1 convolution kernel to capture the semantic relationship in the column direction of the input matrix and extract local features related to the length direction of the text sequence;

[0021] Step 2.4, use 1*5 convolution kernel to capture the semantic relationship in the row direction of the matrix and extract the correlation features between the word meaning and the topic;

[0022] Step 2.5, using a 1*1 convolution kernel to fuse the semantic information obtained from step 2.2 to step 2.4 to form a feature map;

[0023] Step 2.6, flatten the feature map;

[0024] In step 2.7, the multi-head attention mechanism module calculates the attention score of the feature map after the flattening operation, multiplies the attention score by the value, and sums them up to get the output after the attention mechanism. It is calculated in parallel by multiple heads, and finally the outputs of each head are spliced ​​together and subjected to the linear transformation of the feedforward neural network. After the normalization layer and softmax probability distribution, the feature representation is obtained.

[0025] According to a specific implementation of the embodiment of the present disclosure, the expression of the N-pairs loss function is:

[0026]

[0027] Among them, y + and - represents the comparison sample set, d() represents the Euclidean distance calculation function, z x and represents the corresponding characterization vector of the comparison sample text, ξ() represents the penalty function, γ(t) represents the control by time t, t represents the time coefficient, represents the standard deviation calculation formula, rank(y - )-rank(y + ) represents the sorting distance between sample pairs at the current time t.

[0028] In a second aspect, the present disclosure provides a text feature extraction system based on a script-killing scenario, including:

[0029] The preprocessing module is used to obtain the text paragraphs in the script-killing sample data set, perform data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtain a reordered text sequence;

[0030] The extraction module is used to input the text sequence into the feature extraction network to obtain feature representation;

[0031] The training module is used to train the feature extraction network by substituting the labels corresponding to the feature representation and the text sequence into the N-pairs loss function;

[0032] The application module is used to perform data processing operations on the target text and then input the trained feature extraction network to obtain the feature extraction results.

[0033] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:

[0034] at least one processor; and,

[0035] a memory communicatively connected to the at least one processor; wherein,

[0036] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text feature extraction method based on the script-killing scene in the aforementioned first aspect or any implementation of the first aspect.

[0037] In a fourth aspect, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the text feature extraction method based on the script-killing scenario in the aforementioned first aspect or any implementation of the first aspect.

[0038] In the fifth aspect, the embodiments of the present disclosure also provide a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the text feature extraction method based on the script-killing scenario in the aforementioned first aspect or any implementation of the first aspect.

[0039] The text feature extraction scheme based on the script-killing scenario in the disclosed embodiment includes: step 1, obtaining text paragraphs in the script-killing sample data set, performing data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtaining a reordered text sequence; step 2, inputting the text sequence into a feature extraction network to obtain a feature representation; step 3, substituting the labels corresponding to the feature representation and the text sequence into an N-pairs loss function to train the feature extraction network; step 4, performing data processing operations on the target text and inputting the trained feature extraction network to obtain a feature extraction result.

[0040] The beneficial effects of the embodiments of the present disclosure are as follows: through the scheme of the present disclosure, based on the text processing, feature extraction and model training of the script-killing sample data set, preprocessing, feature extraction network and N-pairs loss function and other technologies are adopted to form an efficient end-to-end training process. First, preprocessing through text reordering can help the model better understand the structure of the text and the relationship between characters, thereby improving the training effect. Secondly, the feature extraction network uses deep learning methods to automatically learn the meaningful features of the text, reducing the work of manual design and improving the generalization ability of the model. The N-pairs loss function optimizes the similarity of sample pairs, enhances the model's ability to distinguish subtle differences, and further improves accuracy. Finally, the end-to-end training and reasoning process simplifies the entire process, can flexibly apply the training results to actual tasks, and improves processing efficiency, accuracy and adaptability. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0042] Figure 1 A flowchart of a method for extracting text features based on a script-killing scenario provided by an embodiment of the present disclosure;

[0043] Figure 2 A schematic diagram of the structure of a feature extraction network provided in an embodiment of the present disclosure;

[0044] Figure 3 A structural diagram of a feature extraction network system provided by an embodiment of the present disclosure;

[0045] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0046] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0047] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0048] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0049] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the form, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0050] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0051] The disclosed embodiment provides a feature extraction network method, which can be applied to the script-killing text semantic processing process in the text semantic understanding scenario.

[0052] See also Figure 1 , is a flow chart of a feature extraction network method provided by an embodiment of the present disclosure. Figure 1 As shown, the method mainly comprises the following steps:

[0053] Step 1, obtain the text paragraphs in the script-killing sample data set, perform data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtain a reordered text sequence;

[0054] Furthermore, the step 1 specifically includes:

[0055] Step 1.1, removing noise data in the text paragraph, wherein the noise data includes redundant blank characters and special symbols;

[0056] Step 1.2, use the Jieba word segmentation tool to perform word serialization operation on the text paragraph to obtain the initial text sequence;

[0057] Step 1.3, establish the topic model LDA-latent Dirichlet allocation to identify the topic words in the initial text sequence, and perform reordering and splicing operations to obtain the reordered text sequence.

[0058] Optionally, the subject words include protagonist, supporting role, narration, scene and action expression.

[0059] For example, suppose our input text is a clip of a script-killing game:

[0060] This is the first scene, set in a dark bar.

[0061] The protagonist A walks into the bar and sees the supporting character B talking to the narrator C.

[0062] A: What are you doing here?

[0063] B: I’m waiting for someone.

[0064] Narrator C: Suddenly, the door of the bar was pushed open and footsteps were heard outside.

[0065] First, we need to clean the text to remove unnecessary noise (such as punctuation, line breaks, excessive whitespace, etc.). The noise that may be contained in the text includes:

[0066] Punctuation marks such as periods, commas, colons, blank characters due to line breaks, or irrelevant symbols and special characters, etc. The processed text is: This is the first scene in a dark bar. The protagonist A walks into the bar and sees the supporting character B talking to the narrator C. A What are you doing here? B I'm waiting for someone. Narrator C Suddenly, the door of the bar was pushed open and footsteps were heard outside.

[0067] To further analyze the text content, we will perform word segmentation and split the sentence into a list of words. In Chinese processing, word segmentation tools such as jieba are very commonly used. Here we use the jieba word segmentation tool to split the cleaned text into individual words:

[0068] The result after word segmentation is: ['This is', 'Act 1', 'scene', 'in', 'a', 'dark', 'bar', 'protagonist A', 'walked into', 'bar', 'saw', 'supporting character B', 'who was', 'talking', 'narrator C', 'A', 'what are you', 'doing', 'here', 'B', 'I', 'waiting', 'for', 'someone', 'narrator C', 'suddenly', 'the', 'door', 'of', 'bar', 'was', 'pushed open', 'from outside', 'footsteps'].

[0069] Next, we can use the LDA (latent Dirichlet allocation) model to model the text and identify the potential topics of the text. The LDA model can help us extract some topic words from the words and help identify the words related to these topics in the text.

[0070] Keyword extraction:

[0071] Assume that the following keywords are obtained through LDA model analysis:

[0072] Theme 1: "Bar", "Narration", "Supporting Role", "Protagonist", etc.

[0073] Theme 2: "Footsteps", "Pushing open", "Door", etc.

[0074] Theme 3: “What to do”, “You”, “Here”, etc.

[0075] These themes reflect different plot elements of the script, such as those related to setting, action, and character dialogue.

[0076] Reorder text:

[0077] Based on the topic words of the LDA model, we can reorder the text so that words with similar topics appear together. This helps understand the relationship between different topics and provides clear structural information.

[0078] For example, we can sort words related to scenes (such as "bar"), actions (such as "push away"), and character dialogues (such as "what are you doing here") into different themes.

[0079] Step 2: Input the text sequence into the feature extraction network to obtain feature representation;

[0080] Furthermore, the feature extraction network includes a xception module and a Transformer module.

[0081] Furthermore, the xception module includes multiple convolution kernels of different sizes, and the Transformer module includes multi-head attention, a feedforward neural network and a normalization layer.

[0082] Based on the above embodiment, step 2 specifically includes:

[0083] Step 2.1, the text sequence is divided into three parts: part of speech, semantic theme, and number of phrases to form an input matrix;

[0084] Step 2.2, use 1*1 convolution kernel to perform preliminary dimension adjustment and feature integration on the text features of the input matrix;

[0085] Step 2.3, use a 5*1 convolution kernel to capture the semantic relationship in the column direction of the input matrix and extract local features related to the length direction of the text sequence;

[0086] Step 2.4, use 1*5 convolution kernel to capture the semantic relationship in the row direction of the matrix and extract the correlation features between the word meaning and the topic;

[0087] Step 2.5, using a 1*1 convolution kernel to fuse the semantic information obtained from step 2.2 to step 2.4 to form a feature map;

[0088] Step 2.6, flatten the feature map;

[0089] In step 2.7, the multi-head attention mechanism module calculates the attention score of the feature map after the flattening operation, multiplies the attention score by the value, and sums them up to get the output after the attention mechanism. It is calculated in parallel by multiple heads, and finally the outputs of each head are spliced ​​together and subjected to the linear transformation of the feedforward neural network. After the normalization layer and softmax probability distribution, the feature representation is obtained.

[0090] In specific implementation, the convolution operation of xception and the self-attention operation of Transformer can be integrated into one module. In the first half of the module, a structure similar to Inception is adopted, and convolution kernels of different sizes are used to convolve the input to obtain multiple feature maps; then in the second half of the module, self-attention operations are performed on these feature maps respectively, and the self-attention mechanism is applied to the channel dimension or spatial dimension of each feature map. Finally, the feature maps after the self-attention operation are fused to output the final features of the hybrid module.

[0091] like Figure 2 As shown in the figure, the xception architecture is a deep convolutional neural network architecture. Its main feature is that it uses multiple convolution kernels of different sizes to perform convolution operations on the input at the same time. For example, in GoogLeNet, the xception module contains 1×1, 3×3 and 5×5 convolution kernels. This design allows the network to automatically select the most suitable convolution kernel to extract features, thereby capturing the feature information of images at different scales, which is suitable for tasks such as image classification.

[0092] For example, the xception feature extraction mechanism is:

[0093] The preprocessed text sequence consists of three parts: part of speech, semantic theme, and number of phrases to form the input matrix;

[0094] Each word vector is regarded as a pixel point of a matrix, and the input matrix can be regarded as a "text image";

[0095] The 1*1 convolution layer mainly performs preliminary dimension adjustment and feature integration on the input text features to prepare for subsequent convolutions of different scales. At the same time, it can reduce the amount of calculation to a certain extent and extract some simple semantic association features.

[0096] The 5*1 convolutional layer captures the semantic relationship in the column direction of the matrix, can extract local features related to the length direction of the text sequence, and focuses on capturing the semantic coherence along the length direction of the text;

[0097] The 1*5 convolution captures the semantic relationship in the row direction of the matrix, which can extract the correlation features between the word meaning topics and emphasize the semantic connection between units involved in different topics.

[0098] The 1*1 convolution further integrates the semantic information obtained in the previous steps to facilitate subsequent transmission to other layers.

[0099] Transformer: The Transformer architecture is mainly based on the self-attention mechanism. The self-attention mechanism enables the model to automatically focus on different parts of the input sequence when processing sequence data, thereby effectively capturing dependencies in long sequences. For example, in natural language processing tasks, Transformer can well understand the semantic associations between words in a sentence. It consists of components such as Multi-Head Attention, Feed-Forward Network, and Layer Normalization.

[0100] Innovation: A deep model that has both the local feature extraction capability of Inception and the long-distance relationship modeling capability of Transformer is constructed. Based on the local features extracted by Inception, Transformer can further explore the long-distance dependency relationship between features, thereby obtaining a feature representation with more semantic information.

[0101] For example, the transformer feature extraction mechanism is:

[0102] Flatten the feature map obtained by the xception network layer;

[0103] The main steps of the multi-head attention mechanism module are to calculate the attention score, multiply the attention score by the value, and sum to get the output after the attention mechanism. Through parallel calculation of multiple heads, the outputs of each head are finally spliced ​​together and subjected to a linear transformation to get the final output of the multi-head attention mechanism. In this way, the correlation between phrases in the text can be captured from multiple angles;

[0104] The feedforward neural network performs nonlinear transformation on each word in each position independently to enhance the model's expressiveness, which can help to explore deeper semantic relationships between words, such as action intentions, etc.

[0105] Layer normalization and residual connection. Layer normalization mainly helps stabilize data distribution and converge training loss, while residual connection mainly solves the problem of gradient disappearance.

[0106] Step 3: Substitute the labels corresponding to the feature representation and text sequence into the N-pairs loss function to train the feature extraction network;

[0107] Based on the above embodiment, the expression of the N-pairs loss function is:

[0108]

[0109] Among them, y + and - represents the comparison sample set, d() represents the Euclidean distance calculation function, z x and represents the corresponding characterization vector of the comparison sample text, ξ() represents the penalty function, γ(t) represents the control by time t, t represents the time coefficient, represents the standard deviation calculation formula, rank(y - )-rank(y + ) represents the sorting distance between sample pairs at the current time t.

[0110] In specific implementation, in the original contrast loss, all negative samples are treated equally; however, in the text generation scenario, some generated sequences may be very similar to the real sequences, while others are very different, so there are good and bad negative sample sets.

[0111] Based on the original loss function, the cosine distance is converted into the Euclidean distance to obtain the N-pairs loss function of the present disclosure:

[0112]

[0113] In the new model algorithm, the focus is on the difference in vector lengths. The Euclidean distance is more sensitive to the length of the vector than the cosine distance. For the hyperparameter γ that controls the intensity, time t is introduced to perform dynamic balance. Compared with the original fixed value, this change can provide different levels of constraints at different stages of training to guide model training.

[0114] Then we introduce the concept of standard deviation ξ=γ(t)·Std(rank(y - )-rank(y + )) is used to measure the degree of dispersion or fluctuation of a set of data, making it more intuitive in actually explaining the degree of dispersion of data.

[0115] Step 4: After performing data processing operations on the target text, input the trained feature extraction network to obtain the feature extraction result.

[0116] For example, after we get the script-killing paragraph, we use the script-killing-based text preprocessing method to perform data processing operations on the text segment.

[0117] Text example:

[0118] Input: The protagonist Xiao Ming is carefully searching for a mysterious treasure in an ancient castle, while the supporting character Xiao Hong is watching quietly from the side;

[0119] Output: The protagonist Xiao Ming is in the ancient castle, carefully searching for the mysterious treasure, while the supporting character Xiao Hong is quietly watching from the side.

[0120] After getting the preprocessed text sequence matrix, the feature extraction network xcpetion-bge gets the convolutional features, and then uses transformer to mine the long-distance semantic dependencies in the text features. Finally, the final output result is obtained after normalization and softmax.

[0121] The model output result and the true label value are calculated using the N-pairs variant loss function to obtain the model loss, and then the model iteration and loss convergence are continued.

[0122] Example of model inference results:

[0123] Input: Da Jingsheng is called Da Manhua, he is 28 years old this year, and he has been living an ordinary life for the past 28 years. Da Jingsheng, who has loved painting since childhood, successfully joined a comics company after graduation and became a cartoonist. He has a passionate job, a happy family, and an ideal life. He also draws his happiness in comics to share with more people.

[0124] Output: Da Jingling, also known as Da Manhua, 28 years old; Da Jingling loved drawing since he was a child. After graduation, he successfully entered a comic company and became a cartoonist; Da Jingling has a passionate job and a happy family, and lives an ordinary and ideal life. He also incorporates happiness into comic creation to share it with more people.

[0125] The text feature extraction method based on the script-killing scene provided in this embodiment adopts preprocessing, feature extraction and model training based on the script-killing sample data set, and adopts technologies such as preprocessing, feature extraction network and N-pairs loss function to form an efficient end-to-end training process. First, preprocessing by text reordering can help the model better understand the structure of the text and the relationship between characters, thereby improving the training effect. Secondly, the feature extraction network uses a deep learning method to automatically learn the meaningful features of the text, reducing the work of manual design and improving the generalization ability of the model. The N-pairs loss function enhances the model's ability to distinguish subtle differences by optimizing the similarity of sample pairs, further improving accuracy. Ultimately, the end-to-end training and reasoning process simplifies the entire process, can flexibly apply the training results to actual tasks, and improves processing efficiency, accuracy and adaptability.

[0126] Corresponding to the above method embodiment, see Figure 3 The disclosed embodiment also provides a text feature extraction system 30 based on a script-killing scenario, including:

[0127] Figure 3 The system shown can correspondingly execute the contents of the above method embodiment. For the parts not described in detail in this embodiment, refer to the contents recorded in the above method embodiment and will not be repeated here.

[0128] See also Figure 4 The embodiment of the present disclosure further provides an electronic device 40, which includes: at least one processor and a memory connected to the at least one processor. The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text feature extraction method based on the script-killing scene in the aforementioned method embodiment.

[0129] The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the text feature extraction method based on the script-killing scenario in the aforementioned method embodiment.

[0130] The embodiments of the present disclosure also provide a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the text feature extraction method based on the script-killing scenario in the aforementioned method embodiment.

[0131] Reference below Figure 4 , which shows a schematic diagram of the structure of an electronic device 40 suitable for implementing the embodiment of the present disclosure. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0132] like Figure 4As shown, the electronic device 40 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 to a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 40 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0133] Typically, the following devices may be connected to the I / O interface 405: input devices 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 408 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 409. The communication device 409 may allow the electronic device 40 to communicate wirelessly or wired with other devices to exchange data. Although the electronic device 40 with various devices is shown in the figure, it should be understood that it is not required to implement or have all the devices shown. More or fewer devices may be implemented or have instead.

[0134] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0135] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0136] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0137] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device can execute the relevant steps of the method embodiment.

[0138] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device can perform the relevant steps of the method embodiment.

[0139] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0140] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0141] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware.

[0142] It should be understood that various parts of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.

[0143] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A text feature extraction method based on a script-killing scenario, characterized in that: include: Step 1, obtain the text paragraphs in the script-killing sample data set, perform data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtain a reordered text sequence; Step 2: Input the text sequence into the feature extraction network to obtain feature representation; Step 3: Substitute the labels corresponding to the feature representation and text sequence into the N-pairs loss function to train the feature extraction network; Step 4: After performing data processing operations on the target text, input the trained feature extraction network to obtain the feature extraction result.

2. The method according to claim 1, characterized in that The step 1 specifically includes: Step 1.1, removing noise data in the text paragraph, wherein the noise data includes redundant blank characters and special symbols; Step 1.2, use the Jieba word segmentation tool to perform word serialization operations on the text paragraph to obtain the initial text sequence; Step 1.3, establish the topic model LDA-latent Dirichlet allocation to identify the topic words in the initial text sequence, and perform reordering and splicing operations to obtain the reordered text sequence.

3. The method according to claim 2, characterized in that The subject words include protagonist, supporting role, narration, scene and action expression.

4. The method according to claim 1, characterized in that: The feature extraction network includes a xception module and a Transformer module.

5. The method according to claim 4, characterized in that The xception module includes multiple convolution kernels of different sizes, and the Transformer module includes multi-head attention, a feedforward neural network and a normalization layer.

6. The method according to claim 5, characterized in that The step 2 specifically includes: Step 2.1, the text sequence is divided into three parts: part of speech, semantic theme, and number of phrases to form an input matrix; Step 2.2, use 1*1 convolution kernel to perform preliminary dimension adjustment and feature integration on the text features of the input matrix; Step 2.3, use a 5*1 convolution kernel to capture the semantic relationship in the column direction of the input matrix and extract local features related to the length direction of the text sequence; Step 2.4, use 1*5 convolution kernel to capture the semantic relationship in the row direction of the matrix and extract the correlation features between the word meaning and the topic; Step 2.5, using a 1*1 convolution kernel to fuse the semantic information obtained from step 2.2 to step 2.4 to form a feature map; Step 2.6, flatten the feature map; In step 2.7, the multi-head attention mechanism module calculates the attention score of the feature map after the flattening operation, multiplies the attention score by the value, and sums them up to get the output after the attention mechanism. It is calculated in parallel by multiple heads, and finally the outputs of each head are spliced ​​together and subjected to the linear transformation of the feedforward neural network. After the normalization layer and softmax probability distribution, the feature representation is obtained.

7. The method according to claim 1, characterized in that The expression of the N-pairs loss function is Among them, y + and - represents the comparison sample set, d() represents the Euclidean distance calculation function, z x and z y- represents the corresponding characterization vector of the comparison sample text, ξ() represents the penalty function, γ(t) represents the control by time t, t represents the time coefficient, represents the standard deviation calculation formula, rank(y - )-rank(y + ) represents the sorting distance between sample pairs at the current time t.

8. A text feature extraction system based on script-killing scenarios, characterized in that: include: The preprocessing module is used to obtain the text paragraphs in the script-killing sample data set, perform data processing operations on the text paragraphs through a preprocessing method based on the script-killing text format, and obtain a reordered text sequence; The extraction module is used to input the text sequence into the feature extraction network to obtain feature representation; The training module is used to train the feature extraction network by substituting the labels corresponding to the feature representation and the text sequence into the N-pairs loss function; The application module is used to perform data processing operations on the target text and then input the trained feature extraction network to obtain the feature extraction results.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text feature extraction method based on the script-killing scene described in any one of the preceding claims 1-7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the text feature extraction method based on a script-killing scenario as described in any one of claims 1 to 7.