News text processing method and device, equipment and storage medium

By combining local semantic coding and contextual semantic coding with an attention mechanism, high-order features are generated, which solves the problem of ignoring local and contextual semantics in the existing technology and improves the accuracy of news text classification.

CN118798203APending Publication Date: 2024-10-18CHINA MOBILE (XIONGAN) ICT CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311853418.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-28
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing deep learning algorithms ignore local semantic features and contextual semantics in news text classification, resulting in inaccurate classification predictions.

Method used

Through local semantic coding and contextual semantic coding, combined with the attention mechanism, the local semantic features and contextual semantic features of the news text are fused and coded, high-order features are generated, and news types are predicted based on the high-order features.

Benefits of technology

The accuracy of news text classification is improved, and the accuracy of prediction results is enhanced by weighing the importance of local semantic and contextual semantic features.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798203A_ABST
    Figure CN118798203A_ABST
Patent Text Reader

Abstract

The invention provides a news text processing method and device, equipment and a storage medium. The method comprises the steps of performing local semantic coding on a target news text to obtain local semantic features of the target news text; and performing context semantic coding on the target news text to obtain context semantic features of the target news text. And based on an attention mechanism, performing fusion coding on the local semantic feature and the context semantic feature of the target news text to obtain a high-order feature of the target news text. And predicting a target news type to which the target news text belongs based on the high-order features of the target news text. According to the method, the key effect of the local semantic feature and the context semantic feature in the news text can be analyzed through the attention mechanism, so that the classification to which the news text belongs is predicted based on the local semantic feature and the context semantic feature in combination with the key effect of the local semantic feature and the context semantic feature.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a news text processing method, device, equipment and storage medium. Background Art

[0002] The Internet generates a large amount of news information every day. With the development of artificial intelligence technology, the classification of news information based on deep learning algorithms has been increasingly used.

[0003] At present, the relevant deep learning algorithms mainly extract semantic features from news texts for classification prediction. However, the feature extraction method has no focus and often ignores some keywords or even key contextual semantics in the text, resulting in inaccurate prediction of the final news classification. Summary of the invention

[0004] The purpose of this application is to provide a news text processing method, device, equipment and storage medium, which can analyze the key role of local semantic features and contextual semantic features in news text through an attention mechanism, so as to predict the category to which the news text belongs based on local semantic features and contextual semantic features, combined with the key role of these two features.

[0005] In order to achieve the above purpose, the embodiment of the present application is implemented as follows:

[0006] In a first aspect, a method for processing news text is provided, comprising:

[0007] Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text;

[0008] Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text;

[0009] Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

[0010] In a second aspect, a news text processing device is provided, comprising:

[0011] The encoding module is used to perform local semantic encoding on the target news text to obtain local semantic features of the target news text; and to perform contextual semantic encoding on the target news text to obtain contextual semantic features of the target news text;

[0012] A fusion module, used for fusing and encoding the local semantic features and the contextual semantic features of the target news text based on an attention mechanism to obtain high-order features of the target news text;

[0013] The classification module is used to predict the target news type to which the target news text belongs based on the high-level features of the target news text.

[0014] On the third side, an electronic device is provided, comprising: a processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor performs the following operations:

[0015] Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text;

[0016] Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text;

[0017] Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

[0018] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are implemented:

[0019] Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text;

[0020] Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text;

[0021] Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

[0022] When classifying the target news text, the present application first performs local semantic encoding and contextual semantic encoding on the target news text, thereby obtaining independent local semantic features and contextual semantic features that are related to the context. Next, the local semantic features and contextual semantic features of the target news text are fused and encoded through the attention mechanism, so that the high-order features obtained by the fusion encoding not only reflect the feature information of the two dimensions of local semantics and context semantics, but also reflect the importance of each local semantic feature and each contextual semantic feature. Afterwards, when predicting the type of news to which the target news text belongs based on the high-order features of the target news text, the local semantic features and contextual semantic features can be weighed according to their importance to complete the calculation, thereby improving the prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 This is a first flow chart of the news text processing method according to an embodiment of the present application.

[0025] Figure 2 This is a second flow chart of the news text processing method of the embodiment of the present application.

[0026] Figure 3 This is a third flow chart of the news text processing method of the embodiment of the present application.

[0027] Figure 4 A schematic diagram of the structure of a news text processing device according to an embodiment of the present application.

[0028] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.

[0030] On the one hand, an embodiment of the present application proposes a method for processing news text. Figure 1 The flowchart of the method of this embodiment includes the following steps:

[0031] S102, performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text.

[0032] In this embodiment, performing local semantic coding on the target news text refers to performing independent semantic coding on basic text units (such as single characters, single phrases) in the target news text.

[0033] As an exemplary introduction, local semantic encoding can be completed through the convolutional neural network CNN model. The CNN model includes a convolution layer, a pooling layer, and a fully connected layer. Among them, the convolution layer is used to convolve the word vector matrix of the target news text to obtain the local semantic feature matrix of the target news text; the pooling layer is used to reduce the dimension of the local semantic feature matrix; the fully connected layer is used to convert the local semantic feature matrix after dimensionality reduction into a one-dimensional vector to obtain the local semantic features of the target news text. The word vector matrix mentioned here refers to a preliminary machine language encoding form that converts the target news text into a word vector expression.

[0034] In addition, in this embodiment, contextual semantic encoding of the target news text refers to: semantic encoding of the basic text units in the target news text in combination with the contextual semantic connections between the basic text units.

[0035] As an example, contextual semantic encoding can be accomplished through a gated recurrent unit (GRU) model. The general principle of the GRU model is to iteratively semantically encode the target news text with a text segment as the step length; the semantic encoding features obtained by the current iterative step length encoding are determined based on the semantic encoding features obtained by the previous iterative step length encoding and the text segment of the current iterative step length, and the semantic encoding features obtained by the last iterative step length encoding are used as the contextual semantic features of the target news text.

[0036] S104, based on the attention mechanism, the local semantic features and contextual semantic features of the target news text are fused and encoded to obtain high-order features of the target news text.

[0037] It should be noted that the above-mentioned local semantic coding and context semantic coding both belong to multi-channel coding; that is, S102 can obtain multi-channel local semantic features and multi-channel context semantic features.

[0038] S1041, based on the attention mechanism, calculate the attention of the local semantic features of each channel in the target news text relative to the local semantic features of all channels; and, based on the attention mechanism, calculate the attention of the contextual semantic features of each channel in the target news text relative to the contextual semantic features of all channels.

[0039] The attention mechanism is an existing technology, and its core idea is to find the correlation between the original data based on the original data, so as to highlight certain important features.

[0040] In this embodiment, the attention mechanism is used to analyze the importance of the local semantic features of each channel and the importance of the contextual semantic features of each channel.

[0041] It is essentially an allocation mechanism, the core idea of ​​which is to highlight certain important features of the object. According to the importance of the Attention object, resources are reallocated, i.e., weights.

[0042] S1042, weighting the local semantic features of each channel and the contextual semantic features of each channel in the target news text according to the corresponding attention.

[0043] After using the attention mechanism to determine the importance of the local semantic features of each channel and the importance of the contextual semantic features of each channel, the resources occupied in the subsequent classification prediction can be allocated according to the importance, which is the weighted process of this step.

[0044] S1043, fusing and encoding the weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text to obtain high-order features of the target news text.

[0045] As an exemplary introduction, the weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text can be averaged respectively to obtain the average local semantic features and average contextual semantic features of the target news text; then, the average local semantic features and average contextual semantic features of the target news text are fused to obtain the high-order features of the target news text.

[0046] S106, predicting the target news type to which the target news text belongs based on the high-level features of the target news text.

[0047] Specifically, this embodiment predicts the target news type to which the target news text belongs based on the classifier model and the high-order features of the target news text.

[0048] It should be understood that the fused high-order features include the local semantic features of each channel and the contextual semantic features of each channel, and the local semantic features of each channel and the contextual semantic features of the channel are weighted according to their importance, and the weights reflect the emphasis in the calculation of the classifier model.

[0049] Among them, the classifier model is trained in a supervised manner. As a feasible method, the classifier model can be trained based on the high-order features of the sample news text and the corresponding annotated news type labels. Among them, the news type label is used to indicate the news type (true value) to which the sample news text belongs; the high-order features of the sample news text are obtained by fusing the local semantic features and contextual semantic features of the sample news text (consistent with the high-order feature generation of the target news text). The training principle is to make the classifier model predict the news type to which the sample news text belongs closer to the true news type indicated by the label under the supervision of the label until convergence.

[0050] It should be noted that the news type that the classifier model can predict depends on the sample news texts used in the training phase. For example, if sports news texts, science and technology news texts, and education news texts are used as sample news texts, after the classifier model is finally trained, it can identify whether the target news text belongs to the sports news type, the science and technology news type, or the education news type.

[0051] In practical applications, after the target news type to which the target news text belongs is determined through the classifier model, relevant preset processing operations can be performed on the target news text, such as: news type classification, news type labeling, and news type audience push, etc., which are not specifically limited in this article.

[0052] In summary, when classifying the target news text, the method of this embodiment first performs local semantic encoding and contextual semantic encoding on the target news text, thereby obtaining independent local semantic features and contextual semantic features that are related to the context. Next, the local semantic features and contextual semantic features of the target news text are fused and encoded through the attention mechanism, so that the high-order features obtained by the fusion encoding not only reflect the feature information of the two dimensions of local semantics and context semantics, but also reflect the importance of each local semantic feature and each contextual semantic feature. Afterwards, when predicting the news type to which the target news text belongs based on the high-order features of the target news text, the local semantic features and contextual semantic features can be weighed according to their importance to complete the calculation, thereby improving the prediction accuracy.

[0053] The following is a detailed description of the news text processing method of this embodiment.

[0054] refer to Figure 2 and Figure 3 As shown, this embodiment is based on artificial intelligence technology to build a main structure consisting of a Word2vec model, a CNN model, a GRU model, an Attention encoder and a classifier model. Among them, the Word2vec model is used to preliminarily encode the target news text into a word vector matrix of machine language; on the one hand, the word vector matrix of the target news text is further multi-channel local semantic encoding through the CNN model to obtain multi-channel local semantic features; on the other hand, the text feature vector of the target news text is multi-channel upper and lower semantic encoding through the GRU model to obtain multi-channel contextual semantic features; then, the multi-channel local semantic features and contextual semantic features are encoded and fused according to the Attention mechanism through the Attention encoder to obtain high-order features; finally, the high-order features are predicted by the classifier model to determine the target news type to which the target news text belongs.

[0055] The various functions of the main structure are introduced below.

[0056] 1. Word2vec Model

[0057] The Word2vec model encodes the target news text into a word vector matrix that can be recognized by computers.

[0058] The Word2vec model has two structures: Skip-gram and CBOW. Both Skip-gram and CBOW consist of an input layer, a mapping layer, and an output layer. Skip-gram uses the central word to predict the surrounding words, while CBOW uses the surrounding words to predict the central word. The training speed of CBOW is faster than that of Skip-gram, but Skip-gram expresses better semantics than CBOW, so Skip-gram is selected to train word vectors.

[0059] Skip-gram uses the intermediate word vector W during training. t The conditional probability value is used to solve the context word vector:

[0060]

[0061] Where i = t-1, t-2, t+1, t+2. Assume that the number of words in a text input to the model is N, and use the vector [W1, W2, …, W n ] to represent this text. After the word embedding layer, the text representation is converted into X = [x1, x2, ..., x n ], x i ∈R d , where d is the word vector dimension. It should be understood that the word vector in this embodiment is a way of expressing the text feature vector.

[0062] 2. CNN Model

[0063] Among them, the CNN model includes convolutional layers, pooling layers and fully connected layers.

[0064] The convolution layer is used to convolve the word vector matrix of the target news text to obtain the local semantic feature matrix of the target news text.

[0065] The pooling layer is used to reduce the dimension of the local semantic feature matrix.

[0066] The fully connected layer is used to convert the local semantic feature matrix after dimensionality reduction into a one-dimensional vector to obtain the local semantic features of the target news text.

[0067] It should be noted that the weights of multiple local semantic features obtained at this time are the same, and it is impossible to specifically distinguish the semantic importance of each word.

[0068] Afterwards, the multi-channel local semantic features are used as the input of the Attention encoder.

[0069] 3. GRU model

[0070] The GRU model is used to iteratively semantically encode the target news text with a text segment as a step size; the semantic coding features obtained by the current iterative step size encoding are determined based on the semantic coding features obtained by the previous iterative step size encoding and the text segment of the current iterative step size, and the semantic coding features obtained by the last iterative step size encoding are used as the contextual semantic features of the target news text.

[0071] Among them, the GRU model uses the traditional forward calculation formula:

[0072] r t =σ(W r ·[h t-1 ,x t ])

[0073] z t =σ(W z ·[h t-1 ,x t ])

[0074]

[0075]

[0076] y t =σ(W o ·h t )

[0077] In the formula, σ() is the Sigmoid activation function, tanh() is the hyperbolic tangent function, W is the weight, and h ist is the final output, and the rest are common parameters of the forward calculation formula, which will not be repeated here.

[0078] Afterwards, the local semantic features of the multi-channel are used as h t is the input of the Attention encoder, and the average contextual semantic feature T is obtained according to the same attention score calculation scheme.

[0079] 4. Attention Encoder

[0080] The Attention encoder performs a weighted average of the attention weights of the local semantic features of all channels to obtain the average local semantic feature V. On the other hand, it performs a weighted average of the attention weights of the upper and lower semantic features of all channels to obtain the average upper and lower semantic feature T. After that, the average local semantic feature V and the average upper and lower semantic feature T are fused and encoded to obtain high-order features.

[0081] Among them, the attention weight is reflected by the percentage of attention score in the total.

[0082] The calculation formula of attention score is as follows:

[0083]

[0084] In the formula, Y i represents the i-th local semantic feature (or contextual semantic sign), It is a higher level text representation than word vector, and the other symbols are common formula parameters for attention calculation. As the model is updated during training, the larger the score value, the greater the corresponding attention, and the more important the word.

[0085] The percentage of attention score is:

[0086]

[0087] The weighted average formula based on attention weights is:

[0088]

[0089] 4. Classifier Model

[0090] The classifier model is used to calculate the probability of the target news text for multiple news types based on high-order features. The news type with the highest probability is the target news type to which the target news text belongs.

[0091] The principle of the classifier model has been introduced in the training phase above and will not be repeated here.

[0092] On the other hand, an embodiment of the present application also provides a news text processing device. Figure 4 4 is a schematic diagram of the structure of the processing device 400, including:

[0093] The encoding module 410 is used to perform local semantic encoding on the target news text to obtain local semantic features of the target news text; and to perform contextual semantic encoding on the target news text to obtain contextual semantic features of the target news text.

[0094] The fusion module 420 is used to fuse and encode the local semantic features and contextual semantic features of the target news text based on the attention mechanism to obtain high-order features of the target news text.

[0095] The classification module 430 is used to predict the target news type to which the target news text belongs based on the high-level features of the target news text.

[0096] When classifying the target news text, the device of this embodiment first performs local semantic encoding and contextual semantic encoding on the target news text, thereby obtaining independent local semantic features and contextual semantic features that are related to the context. Next, the local semantic features and contextual semantic features of the target news text are fused and encoded through the attention mechanism, so that the high-order features obtained by the fusion encoding not only reflect the feature information of the two dimensions of local semantics and context semantics, but also reflect the importance of each local semantic feature and each contextual semantic feature. Afterwards, when predicting the news type to which the target news text belongs based on the high-order features of the target news text, the local semantic features and contextual semantic features can be weighed according to their importance to complete the calculation, thereby improving the prediction accuracy.

[0097] Optionally, both the local semantic coding and the contextual semantic coding belong to multi-channel coding; the fusion module 420 fuses and encodes the local semantic features and the contextual semantic features of the target news text based on the attention mechanism to obtain high-order features of the target news text, including: calculating the attention of the local semantic features of each channel in the target news text relative to the local semantic features of all channels based on the attention mechanism; and, calculating the attention of the contextual semantic features of each channel in the target news text relative to the contextual semantic features of all channels based on the attention mechanism; weighting the local semantic features of each channel and the contextual semantic features of each channel in the target news text according to the corresponding attention; fusing and encoding the weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text to obtain high-order features of the target news text.

[0098] Optionally, the fusion module 420 performs fusion encoding on the weighted local semantic features and weighted contextual semantic features in the target news text to obtain high-order features of the target news text, including: averaging the weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text to obtain average local semantic features and average contextual semantic features of the target news text; and fusing the average local semantic features and average contextual semantic features of the target news text to obtain high-order features of the target news text.

[0099] Optionally, the encoding module 410 performs local semantic encoding on the target news text to obtain local semantic features of the target news text, including: performing local semantic encoding on the target news text based on a convolutional neural network (CNN) model to obtain local semantic features of the target news text; wherein the CNN model includes a convolutional layer, a pooling layer and a fully connected layer; the convolutional layer is used to convolve the word vector matrix of the target news text to obtain a local semantic feature matrix of the target news text; the pooling layer is used to reduce the dimension of the local semantic feature matrix; the fully connected layer is used to convert the local semantic feature matrix after dimension reduction into a one-dimensional vector to obtain the local semantic features of the target news text.

[0100] Optionally, the encoding module 410 performs contextual semantic encoding on the target news text to obtain contextual semantic features of the target news text, including: performing contextual semantic encoding on the target news text based on a gated recurrent unit (GRU) model to obtain contextual semantic features of the target news text; wherein the GRU model is used to iteratively semantically encode the target news text with a text segment as a step size; the semantic encoding features obtained by encoding at a current iteration step size are determined based on the semantic encoding features obtained by encoding at a previous iteration step size and the text segment of the current iteration step size, and the semantic encoding features obtained by encoding at the last iteration step size are used as the contextual semantic features of the target news text.

[0101] Optionally, the classification module 430 predicts the target news type to which the target news text belongs based on the high-order features of the target news text, including: based on a classifier model, predicting the target news type to which the target news text belongs according to the high-order features of the target news text; wherein the classifier model is trained based on the high-order features of the sample news text and the corresponding annotated news type labels; the news type label is used to indicate the news type to which the sample news text belongs; the high-order features of the sample news text are obtained by fusing the local semantic features and contextual semantic features of the sample news text.

[0102] Optionally, the device of this embodiment further includes:

[0103] A preset processing module is used to perform preset processing operations related to the target news type on the target news text; wherein the preset processing operations include: at least one of news type classification, news type labeling and news type audience push.

[0104] Obviously, the news text processing device of this embodiment can be used as Figure 1 The execution subject of the method shown can thus realize Figure 1 The steps and functions in the method shown.

[0105] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this specification. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0106] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0107] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes computer operation instructions. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs the following operations:

[0108] Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text.

[0109] Based on the attention mechanism, the local semantic features and contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text.

[0110] Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

[0111] The above-mentioned news text processing method disclosed in the embodiment shown in this specification can be applied to a processor and implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0112] Of course, in addition to software implementation, the electronic device of this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0113] In addition, the present application also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions. When the above instructions are executed by a portable electronic device including multiple application programs, the portable electronic device can execute Figure 1 The steps of the method shown include:

[0114] Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text.

[0115] Based on the attention mechanism, the local semantic features and contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text.

[0116] Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

[0117] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0118] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0119] The above are only embodiments of this specification and are not intended to limit this specification. For those skilled in the art, this specification may be subject to various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the scope of the claims of this specification. In addition, all other embodiments obtained by ordinary technicians in this field without creative work shall fall within the scope of protection of this document.

Claims

1. A method for processing news text, characterized in that: include: Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text; Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text; Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

2. The method according to claim 1, characterized in that The local semantic coding and the context semantic coding both belong to multi-channel coding; Based on the attention mechanism, the local semantic features and contextual semantic features of the target news text are fused and encoded to obtain high-level features of the target news text, including: Based on the attention mechanism, the attention of the local semantic features of each channel in the target news text relative to the local semantic features of all channels is calculated; and based on the attention mechanism, the attention of the contextual semantic features of each channel in the target news text relative to the contextual semantic features of all channels is calculated; The local semantic features of each channel and the contextual semantic features of each channel in the target news text are weighted according to the corresponding attentions; The weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text are fused and encoded to obtain high-order features of the target news text.

3. The method according to claim 2, characterized in that The weighted local semantic features and the weighted contextual semantic features in the target news text are fused and encoded to obtain high-level features of the target news text, including: The weighted local semantic features of all channels and the weighted contextual semantic features of all channels in the target news text are averaged to obtain the average local semantic features and average contextual semantic features of the target news text; The average local semantic features and the average contextual semantic features of the target news text are fused to obtain high-order features of the target news text.

4. The method according to claim 1, characterized in that: Performing local semantic coding on the target news text to obtain local semantic features of the target news text includes: Performing local semantic encoding on the target news text based on a convolutional neural network (CNN) model to obtain local semantic features of the target news text; Among them, the CNN model includes a convolution layer, a pooling layer and a fully connected layer; the convolution layer is used to convolve the word vector matrix of the target news text to obtain the local semantic feature matrix of the target news text; the pooling layer is used to reduce the dimension of the local semantic feature matrix; the fully connected layer is used to convert the local semantic feature matrix after dimension reduction into a one-dimensional vector to obtain the local semantic features of the target news text.

5. The method according to claim 1, characterized in that: Performing context semantic encoding on the target news text to obtain context semantic features of the target news text includes: Performing context semantic encoding on the target news text based on a gated recurrent unit (GRU) model to obtain context semantic features of the target news text; Among them, the GRU model is used to iteratively semantically encode the target news text with a text segment as a step size; the semantic coding features obtained by the current iterative step size encoding are determined based on the semantic coding features obtained by the previous iterative step size encoding and the text segment of the current iterative step size, and the semantic coding features obtained by the last iterative step size encoding are used as the contextual semantic features of the target news text.

6. The method according to claim 1, characterized in that Predicting the target news type to which the target news text belongs based on the high-level features of the target news text includes: Based on the classifier model, according to the high-order features of the target news text, predict the target news type to which the target news text belongs; Among them, the classifier model is trained based on the high-order features of the sample news text and the corresponding annotated news type labels; the news type label is used to indicate the news type to which the sample news text belongs; the high-order features of the sample news text are obtained by fusing the local semantic features and contextual semantic features of the sample news text.

7. The method according to claim 1, characterized in that After predicting the target news type to which the target news text belongs based on the target feature, the method further includes: The target news text is subjected to a preset processing operation related to the target news type; wherein the preset processing operation includes: at least one of news type classification, news type labeling and news type audience push.

8. A news text processing device, characterized in that: include: The encoding module is used to perform local semantic encoding on the target news text to obtain local semantic features of the target news text; and to perform contextual semantic encoding on the target news text to obtain contextual semantic features of the target news text; A fusion module, used for fusing and encoding the local semantic features and the contextual semantic features of the target news text based on an attention mechanism to obtain high-order features of the target news text; The classification module is used to predict the target news type to which the target news text belongs based on the high-level features of the target news text.

9. An electronic device, comprising: processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the following operations: Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text; Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text; Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the following steps are implemented: Performing local semantic coding on the target news text to obtain local semantic features of the target news text; and performing contextual semantic coding on the target news text to obtain contextual semantic features of the target news text; Based on the attention mechanism, the local semantic features and the contextual semantic features of the target news text are fused and encoded to obtain the high-order features of the target news text; Based on the high-level features of the target news text, the target news type to which the target news text belongs is predicted.