Text difficulty grading method, apparatus and electronic device

The text difficulty classification model, composed of a local recognition network and a document recognition network, solves the problem that existing technologies cannot accurately classify long texts, and achieves accurate text difficulty classification for long texts.

CN115238074BActive Publication Date: 2026-01-02人民教育出版社有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210878641.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-01-02
Estimated Expiration
2042-07-25

AI Technical Summary

Technical Problem

Existing technologies cannot accurately classify the difficulty of long texts or capture long-distance dependencies.

Method used

A text difficulty grading model composed of a local recognition network and a document recognition network is adopted. The local recognition network extracts local features, and the document recognition network obtains document features. Then, linear transformation and normalization are performed to determine the text difficulty level.

Benefits of technology

It achieves accurate text difficulty classification for long texts, overcoming the shortcomings of existing technologies that cannot capture long-distance dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115238074B_ABST
    Figure CN115238074B_ABST
Patent Text Reader

Abstract

The application provides a text difficulty grading method and device and electronic equipment, acquires a to-be-recognized text, and inputs the to-be-recognized text into a text difficulty grading model. The text difficulty grading model comprises a local recognition network and a chapter recognition network, the local recognition network is used to acquire local features corresponding to the to-be-recognized text, the chapter recognition network is used to acquire chapter features corresponding to the to-be-recognized text, the to-be-recognized text is analyzed and recognized from the local to the global by the local recognition network and the chapter recognition network, and the to-be-recognized text is graded, and finally the text difficulty level of the to-be-recognized text is output. The application overcomes the defects that long-distance dependency relationships cannot be captured and grading is inaccurate in the prior art, and realizes accurate text difficulty grading of long texts.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and in particular to a text difficulty grading method, device and electronic equipment. BACKGROUND

[0002] Text difficulty grading, also known as readability assessment, is a basic research topic in the field of education and teaching. The task of text difficulty grading is to determine the difficulty of a given text for readers of a certain level.

[0003] The convolutional neural network model in the prior art can recognize and grade short texts such as words and sentences, but cannot capture long-range dependencies such as articles and grade difficulty; the recurrent neural network can handle sequence structures, but the grading results will be affected by the different positions of key words.

[0004] Therefore, it is a current urgent problem to propose a text difficulty grading method to accurately grade long texts. SUMMARY

[0005] The present application provides a text difficulty grading method, device and electronic equipment to solve the defect that the prior art cannot accurately grade long texts, and to accurately grade long texts.

[0006] The present application provides a text difficulty grading method, comprising:

[0007] obtaining a text to be recognized;

[0008] inputting the text to be recognized into a text difficulty grading model to output a text difficulty level of the text to be recognized;

[0009] The text difficulty grading model comprises a local recognition network and a chapter recognition network, the local recognition network is used to obtain local features corresponding to the text to be recognized, and the chapter recognition network is used to obtain chapter features corresponding to the text to be recognized.

[0010] According to the text difficulty grading method provided by the present application, the text to be recognized is input into a text difficulty grading model to output a text difficulty level of the text to be recognized, comprising:

[0011] extracting local features of the text to be recognized through the local recognition network;

[0012] processing the local features through the chapter recognition network to obtain chapter features of the text to be recognized;

[0013] linearly transforming and normalizing the chapter features to obtain a text difficulty probability distribution;

[0014] determining a text difficulty level of the to-be-recognized text according to the text difficulty probability distribution, and outputting the text difficulty level of the to-be-recognized text.

[0015] According to the text difficulty grading method provided by the application, the text difficulty grading model is obtained by the following steps, comprising:

[0016] obtaining a to-be-recognized text sample and a corresponding real label;

[0017] extracting a local feature sample of the to-be-recognized text sample through an initial local recognition network;

[0018] processing the local feature sample through an initial chapter recognition network to obtain a chapter feature sample of the to-be-recognized text sample;

[0019] performing linear transformation and normalization on the chapter feature sample to obtain a text difficulty probability distribution sample;

[0020] calculating a loss function according to the text difficulty probability distribution sample and the real label;

[0021] iteratively updating parameters of the initial local recognition network and parameters of the initial chapter recognition network according to the loss function, and determining the initial local recognition network after iterative updating as the local recognition network and determining the initial chapter recognition network after iterative updating as the chapter recognition network.

[0022] According to the text difficulty grading method provided by the application, the initial local recognition network comprises a variable-length convolution layer and a block structure.

[0023] The extracting of the local feature sample of the to-be-recognized text sample through the initial local recognition network comprises:

[0024] determining a to-be-recognized text sequence sample according to the to-be-recognized text sample;

[0025] performing convolution and splicing on the to-be-recognized text sequence sample through the variable-length convolution layer to obtain a variable-length convolution layer output feature sample;

[0026] performing iterative pooling convolution on the variable-length convolution layer output feature sample through the block structure to obtain a feature map sample;

[0027] exchanging a channel dimension and a height dimension of the feature map sample to obtain the local feature sample.

[0028] According to the text difficulty grading method provided by the application, the initial chapter recognition network comprises a bidirectional long short-term memory network.

[0029] The processing of the local feature sample by the initial chapter recognition network comprises:

[0030] The local feature sample is input into the bidirectional long short-term memory network to obtain a plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points;

[0031] The chapter feature sample is determined according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0032] According to the text difficulty grading method provided by the application, the chapter feature sample is determined according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points, which comprises:

[0033] The forward hidden layer vector sample and the reverse hidden layer vector sample corresponding to the same time point are spliced to obtain a corresponding context sequence;

[0034] The context sequence weight is determined according to the context sequence and a preset context vector;

[0035] The chapter feature sample is determined according to the context sequence and the context sequence weight.

[0036] According to the text difficulty grading method provided by the application, the loss function is calculated according to the text difficulty probability distribution sample and the real label corresponding to the text sample to be recognized, which comprises:

[0037] The real label is smoothed to obtain a smoothed real label;

[0038] The loss function is calculated according to the smoothed real label and the text difficulty probability distribution sample.

[0039] The application further provides a text difficulty grading device, which comprises:

[0040] An acquisition unit is configured to acquire a text to be recognized.

[0041] A grading unit is configured to input the text to be recognized into a text difficulty grading model and output a text difficulty level of the text to be recognized.

[0042] The text difficulty grading model comprises a local recognition network and a chapter recognition network, the local recognition network is configured to acquire local features corresponding to the text to be recognized, and the chapter recognition network is configured to acquire chapter features corresponding to the text to be recognized.

[0043] The application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the text difficulty grading method according to any one of the above when executing the computer program.

[0044] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to implement the steps of the text difficulty grading method according to any one of the above.

[0045] The application further provides a computer program product, comprising a computer program, wherein the computer program is executed by a processor to implement the steps of the text difficulty grading method according to any one of the above.

[0046] The application provides a text difficulty grading method, device and electronic device, wherein a text to be recognized is obtained, and the text to be recognized is input into a text difficulty grading model. The text difficulty grading model comprises a local recognition network and a chapter recognition network. The local recognition network is used to obtain local features corresponding to the text to be recognized, the chapter recognition network is used to obtain chapter features corresponding to the text to be recognized, the local recognition network and the chapter recognition network are used to analyze and recognize the text to be recognized from local to global and in all aspects, and the text difficulty level of the text to be recognized is finally output. The long-distance dependency relationship can be captured, and the text difficulty grading is accurate. BRIEF DESCRIPTION OF DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0048] Figure 1 is a flowchart of the text difficulty grading method provided by the present application;

[0049] Figure 2 is a flowchart of the text difficulty grading model training method provided by the present application;

[0050] Figure 3 is a schematic diagram of an initial local recognition network in the text difficulty grading model provided by the present application;

[0051] Figure 4 is a schematic diagram of an initial chapter recognition network in the text difficulty grading model provided by the present application;

[0052] Figure 5It is a structural schematic diagram of the text difficulty grading device provided by the application.

[0053] Figure 6 It is a structural schematic diagram of the electronic device provided by the application. DETAILED DESCRIPTION

[0054] To make the objectives, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0055] The present application provides a text difficulty grading method, as shown in the formula (I), comprising: Figure 1

[0056] S11, obtaining a text to be recognized.

[0057] S12, inputting the text to be recognized into a text difficulty grading model to output a text difficulty level of the text to be recognized.

[0058] The text difficulty grading model comprises a local recognition network and a chapter recognition network, the local recognition network is used to obtain local features corresponding to the text to be recognized, and the chapter recognition network is used to obtain chapter features corresponding to the text to be recognized.

[0059] In the embodiments of the present application, the text to be recognized is obtained, and the text to be recognized is input into a text difficulty grading model. The text difficulty grading model comprises a local recognition network and a chapter recognition network, the local features corresponding to the text to be recognized are obtained through the local recognition network, the chapter features corresponding to the text to be recognized are obtained through the chapter recognition network, the text to be recognized is analyzed and recognized from local to global through the local recognition network and the chapter recognition network, and the text difficulty level of the text to be recognized is finally output. The defects that long-distance dependency relationship cannot be captured and the grading is inaccurate in the prior art are overcome, and accurate text difficulty grading of long text is realized.

[0060] According to the text difficulty grading method provided by the present application, step S12 specifically comprises S121-S124.

[0061] S121, extracting local features of the text to be recognized through the local recognition network.

[0062] S122, processing the local features through the chapter recognition network to obtain chapter features of the text to be recognized.

[0063] ​S123, linearly transforming and normalizing the passage feature to obtain a text difficulty probability distribution.

[0064] S124, determining a text difficulty level of the to-be-recognized text according to the text difficulty probability distribution, and outputting the text difficulty level of the to-be-recognized text.

[0065] Specifically, the local recognition network can extract local features of the to-be-recognized text, and the local features are used to represent features of short texts such as words or single sentences in the to-be-recognized text. The passage recognition network can convert the local features into global features by processing the local features, extract passage features of the to-be-recognized text, and the passage features are used to represent features of long texts such as the entire article of the to-be-recognized text.

[0066] After obtaining the passage features, the passage features can be linearly transformed to reduce the dimension of the passage features, and then normalized to convert the passage features into a probability distribution on a preset number of grades, to obtain a text difficulty probability distribution.

[0067] According to the text difficulty probability distribution, the text difficulty level to which the to-be-recognized text can be divided and the corresponding probability can be known. Optionally, the grade level corresponding to the highest probability can be determined as the text difficulty level of the to-be-recognized text and the text difficulty level is output.

[0068] Specifically, the training phase and the application phase of the text difficulty grading model are similar, and steps S121-S124 are the application phase of the text difficulty grading model, and the specific details of the training phase of the text difficulty grading model described below can be referred to.

[0069] In the embodiment of the application, the local recognition network and the passage recognition network gradually analyze the features of the to-be-recognized text from the local features of the short texts such as words and sentences of the text to the passage features of the entire article, fully embody and depict the attribute features of the to-be-recognized text. Linearly transforming and normalizing the passage features converts the feature information of the to-be-recognized text into the grade to which the to-be-recognized text can be divided and the corresponding probability, and then determines the text difficulty level of the to-be-recognized text according to the text difficulty probability distribution. The defects of being unable to capture long-distance dependency and inaccurate grading in the prior art are overcome, and accurate text difficulty grading of long texts is realized.

[0070] According to the text difficulty grading method provided by the application, as shown in Figure 2 The text difficulty grading model is obtained by the following steps, comprising:

[0071] S21, obtaining a to-be-recognized text sample and a corresponding real label.

[0072] Specifically, a text sample to be recognized for training and a real label corresponding to the text sample to be recognized can be obtained. In an example, an article is obtained from a third-grade textbook, the article is taken as a text sample to be recognized, and the real label corresponding to the article is third grade or a grading level of three. The content of the real label can be set according to actual needs, and is not limited in this regard.

[0073] S22, extracting a local feature sample of the text sample to be recognized by using an initial local recognition network.

[0074] Specifically, the local feature sample of the text sample to be recognized is extracted by using the initial local recognition network, and the local feature sample is used to represent the features of short texts such as words or sentences of the text sample to be recognized.

[0075] S23, processing the local feature sample by using an initial passage recognition network to obtain a passage feature sample of the text sample to be recognized.

[0076] Specifically, the local feature sample can be processed by using the initial passage recognition network to convert the local features into global features, and the passage feature sample of the text sample to be recognized is extracted, which is used to represent the features of long texts such as the whole article of the text sample to be recognized.

[0077] S24, performing linear transformation and normalization on the passage feature sample to obtain a text difficulty probability distribution sample.

[0078] Specifically, in an example, the passage feature sample can be linearly transformed and normalized by using the following formula 1 to obtain the text difficulty probability distribution sample:

[0079] p i = softmax(linear(T)) (1)

[0080] wherein T represents the passage feature sample, linear represents linear transformation, softmax represents normalization, and p i represents the text difficulty probability distribution sample.

[0081] After obtaining the passage feature sample, the multi-dimensional passage feature sample is converted from a vector form into a probability distribution on a preset number of levels by linear transformation and normalization to obtain the text difficulty probability distribution sample.

[0082] S25, calculating a loss function according to the text difficulty probability distribution sample and the real label.

[0083] Specifically, after obtaining the text difficulty probability distribution sample, the loss function is calculated in combination with the real label corresponding to the to-be-identified text sample, and the learning ability of the model for the task of text difficulty classification of the to-be-identified text sample is described through the loss function.

[0084] S26, iteratively update the parameters of the initial local recognition network and the parameters of the initial chapter recognition network according to the loss function, determine the iteratively updated initial local recognition network as the local recognition network, and determine the iteratively updated initial chapter recognition network as the chapter recognition network.

[0085] Specifically, the learning ability of the model for the task of difficulty classification of the to-be-identified text sample can be understood through the loss function. When the loss function meets a preset condition, for example, the loss function calculated by the above steps for a batch of to-be-identified text samples and corresponding real labels is continuously decreasing, it indicates that the model is learning the task of text difficulty classification normally. At this time, the parameters of the initial local recognition network and the parameters of the initial chapter recognition network are updated through the loss function and iteratively, and the updated initial local recognition network and the initial chapter recognition network are iteratively trained according to the above steps. For example, the number of iterations is set to 1000, and after 1000 iterations are completed, the training is completed, and the updated initial local recognition network and the initial chapter recognition network are determined as the local recognition network and the chapter recognition network.

[0086] In the embodiment of the application, the initial local recognition network is input with the to-be-identified text sample to extract the local feature sample, the local feature sample is input into the initial chapter recognition network to obtain the chapter feature sample, the chapter feature sample is linearly transformed and normalized to obtain the text difficulty probability distribution sample. The loss function is calculated according to the text difficulty probability distribution sample and the real label corresponding to the to-be-identified text sample, the learning ability of the model for the text difficulty classification task is represented through the loss function, the parameters of the initial local recognition network and the initial chapter recognition network are iteratively updated through the loss function, and the local recognition network and the chapter recognition network are obtained. The defects that long-distance dependency cannot be captured and classification is inaccurate in the prior art are overcome, and accurate text difficulty classification of long text is realized.

[0087] According to the text difficulty classification method provided by the application, the initial local recognition network comprises a variable-length convolution layer and a block structure; step S22 specifically comprises S221-S224.

[0088] Specifically, as shown in Figure 3 the initial local recognition network is input with the to-be-identified text sample to extract the local feature sample, the local feature sample is input into the initial chapter recognition network to obtain the chapter feature sample, the chapter feature sample is linearly transformed and normalized to obtain the text difficulty probability distribution sample. The loss function is calculated according to the text difficulty probability distribution sample and the real label corresponding to the to-be-identified text sample, the learning ability of the model for the text difficulty classification task is represented through the loss function, the parameters of the initial local recognition network and the initial chapter recognition network are iteratively updated through the loss function, and the local recognition network and the chapter recognition network are obtained. The defects that long-distance dependency cannot be captured and classification is inaccurate in the prior art are overcome, and accurate text difficulty classification of long text is realized. Figure 3and steps S221-S224, the initial local recognition network can perform N-gram feature extraction to extract N-gram representation from word-level word vector representation by using a convolutional neural network CNN.

[0089] S221, determining a text sequence sample to be recognized according to the text sample to be recognized.

[0090] Specifically, the text sample to be recognized is segmented to obtain the text sequence sample to be recognized. In one example, the text sequence sample to be recognized obtained by segmenting the text to be recognized is X=(x1,…,x i ,…,x n ), x i ∈R dim , X∈R n ×dim . Wherein x i is the word vector of the i-th word, R represents the real set, and dim is the embedding dimension, and the optional embedding dimension is 128.

[0091] S222, performing convolution and splicing on the text sequence sample to be recognized by the variable-length convolution layer to obtain a variable-length convolution layer output feature sample.

[0092] Specifically, the text sample to be recognized for text difficulty classification is mostly primary and secondary school teaching materials. Unlike general data sets whose text length obeys normal distribution, due to its natural properties, the length of the text in the data set is very different, most of the low-grade text is short, and the high-grade text can be very long. Therefore, the length of the text sequence sample is compressed first, and convolution and splicing are performed, and feature extraction is performed on the sentence by the variable-length convolution layer, that is, as the sequence increases, the corresponding convolution kernel size and step size also increase.

[0093] In one example, the text sequence sample to be recognized can be convolved and spliced by the following formula 2 and formula 3:

[0094]

[0095] F=conv(concat(f i )(, i=0,1,2,3,4 (3)

[0096] Wherein λ i represents a coefficient for text sequence segmentation, represents a text sequence sample segment intercepted from the text sequence sample to be recognized X conv represents convolution operation, f i represents the feature representation obtained after convolution, and concat(f i ) represents f iAlong the dimension of height, F is the output feature representation of the entire variable-length convolutional layer, i.e. the variable-length convolutional layer output feature sample.

[0097] S223, iteratively pool and convolve the variable-length convolutional layer output feature sample through the block structure to obtain a feature map sample.

[0098] Specifically, the variable-length convolutional layer output feature sample is down-sampled through the block structure Block, and the sequence length of the next convolutional layer is halved after each down-sampling. Then, down-sampling and convolution are performed again, and the coverage of the convolution kernel on the original text is increased through such iteration. After K times of down-sampling, the convolution kernel is equivalent to covering the original text of length 2 K After K times of down-sampling, the convolution kernel is equivalent to covering the original text of length 2

[0099] In one example, the variable-length convolutional layer output feature sample can be pooled and convolved through the following formulas 4 and 5:

[0100] px = pooling (F) (4)

[0101] FM = conv (conv (px)) + px (5)

[0102] where F is the output feature representation of the entire variable-length convolutional layer, i.e. the variable-length convolutional layer output feature sample, pooling represents the pooling operation, which is a way of down-sampling, px represents the result of pooling F, conv represents the convolution operation, and FM is the feature map sample. Here, FM can be substituted into F to perform iteration of formulas 3 and 4 again, and the iteration number can be set according to the sequence length and specific tasks.

[0103] S224, exchange the channel dimension and the height dimension of the feature map sample to obtain the local feature sample.

[0104] Specifically, after obtaining the final feature map sample, the channel dimension and the height dimension of the feature map sample can be exchanged through the following formula 6 to obtain the local feature sample:

[0105] S = permute (FM) (6)

[0106] where permute (FM) represents exchanging the channel dimension and the height dimension of the feature map sample FM, S represents the extracted N-gram feature, i.e. the local feature sample, and S ∈ R l×Cwherein l is the height of the feature map sample, C is the number of channels of the convolution kernel, and R is a real set.

[0107] In the embodiment of the present application, the text sample to be recognized is segmented by determining the text sequence sample to be recognized according to the text sample to be recognized, so as to facilitate subsequent extraction of local features of short texts such as words of the text sample to be recognized; the text sequence sample to be recognized is convolved and spliced by the variable-length convolution layer to obtain a variable-length convolution layer output feature sample, and the variable-length convolution layer is used for feature extraction of a sentence; the variable-length convolution layer output feature sample is iteratively pooled and convolved by a block structure to obtain a feature map sample; and the channel dimension and the height dimension of the feature map sample are exchanged to obtain a local feature sample, so that the extraction capability of the model for global features is greatly enhanced. At the same time, since the sequence length is compressed, it is helpful for subsequent extraction of chapter-level representation.

[0108] According to the text difficulty grading method provided in the present application, the initial chapter recognition network comprises a bidirectional long short-term memory network; and step S23 specifically comprises S231-S232.

[0109] S231, inputting the local feature sample into the bidirectional long short-term memory (LSTM) network to obtain a plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0110] Specifically, the role of chapter feature sample extraction is to extract text representation at the chapter level from N-gram feature representation (i.e. local feature sample), and a bidirectional LSTM network is used, and an attention mechanism can be optionally added.

[0111] In one example, the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points can be obtained by the following formula 7:

[0112]

[0113] wherein S is a local feature sample, represents a forward hidden layer vector sample corresponding to each time point, represents a reverse hidden layer vector sample corresponding to each time point, and l is the height of the feature map sample.

[0114] S232, determining the chapter feature sample according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0115] Specifically, determining the chapter feature sample according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points can include, but is not limited to, the following two specific methods.

[0116] Method 1: The forward hidden layer vector sample of the forward LSTM and the last backward hidden layer vector sample of the backward LSTM are spliced by formula 8 as follows, and the spliced result is taken as the final text representation T, i.e., the chapter feature sample:

[0117]

[0118] wherein, represents that the forward hidden layer vector sample of the forward LSTM and the last backward hidden layer vector sample are spliced to obtain the chapter feature sample.

[0119] Method 2: An attention mechanism is added on the basis of the bidirectional LSTM network. S232 specifically includes S2321-S2323.

[0120] S2321, the forward hidden layer vector sample and the backward hidden layer vector sample corresponding to the same moment are spliced to obtain the corresponding context sequence.

[0121] S2322, the context sequence weight is determined according to the context sequence and a preset context vector.

[0122] S2323, the chapter feature sample is determined according to the context sequence and the context sequence weight.

[0123] Specifically, in an example, the forward hidden layer vector sample and the backward hidden layer vector sample corresponding to the same moment can be spliced to obtain the corresponding context sequence by formula 9 as follows:

[0124]

[0125] wherein h=(h1,…,h i ,…,h l ), represents the context sequence, i∈[1,l], and l is the height of the feature map sample.

[0126] The context sequence weight can be determined according to the context sequence and a preset context vector by formula 10 as follows:

[0127]

[0128] wherein α i is the context sequence weight corresponding to the context sequence, u is an initialized learnable context vector, u∈R 2×hidde , and hidden is the dimension of the LSTM hidden layer vector sample.

[0129] The passage feature sample can be determined according to the context sequence and the context sequence weight by the following formula 11:

[0130]

[0131] In the embodiment of the application, the initial passage recognition network comprises a bidirectional LSTM network, the local feature sample is input into the bidirectional LSTM network, the forward hidden layer vector sample and the reverse hidden layer vector sample corresponding to a plurality of time points are obtained, and the passage feature sample is determined according to the forward hidden layer vector sample and the reverse hidden layer vector sample corresponding to the plurality of time points. The local feature sample of the short text such as words and sentences of the text sample to be recognized is converted into the passage feature sample of the passage level by the bidirectional LSTM of the initial passage recognition network, so that the long-distance dependency relationship is captured.

[0132] According to the text difficulty grading method provided in the application, step S25 specifically comprises S251-S252.

[0133] S251, the real label is smoothed to obtain a smoothed real label.

[0134] S252, the loss function is calculated according to the smoothed real label and the text difficulty probability distribution sample.

[0135] Specifically, the label smoothing training can resist noise, produce a better calibrated network, and thus better generalize, and finally produce more accurate predictions on unseen test data. For traditional text classification tasks, such as news text classification, positive and negative sentiment analysis, etc., different labels are mutually exclusive. However, in the difficulty grading task, different labels are not completely mutually exclusive, and there is a cross between levels, especially adjacent levels. Using the smoothed label can more truly reflect the text difficulty distribution.

[0136] In one example, the real label can be smoothed to obtain a smoothed real label by the following formula 12 and formula 13, and the loss function can be calculated according to the smoothed real label and the text difficulty probability distribution sample by formula 14.

[0137]

[0138]

[0139]

[0140] wherein y onehot is a one-hot encoding form of a real label corresponding to the text sample to be recognized, eps is a smoothing coefficient, N is a total number of categories of multi-classification in the preset text difficulty grading task, target represents a target recognition text sample, yi p is a smoothed true label corresponding to the text sample to be identified i The text difficulty probability distribution sample represents a text sample to be identified.

[0141] In the embodiment of the present application, by smoothing the true label, noise can be better resisted, a better calibration network can be generated, and better generalization can be achieved, so that more accurate predictions can be made for invisible test data. The loss function calculated by the smoothed true label and the text difficulty probability distribution sample can better describe the learning ability of the model for the text difficulty classification task, and thus a more accurate text difficulty classification model can be trained to achieve accurate text difficulty classification.

[0142] The text difficulty classification device provided by the present application will be described below. The text difficulty classification device described below can be correspondingly referred to the text difficulty classification method described above.

[0143] The present application also provides a text difficulty classification device, as shown in the accompanying drawings, comprising: Figure 5 The acquisition unit 51 is configured to acquire a text to be identified.

[0144] The classification unit 52 is configured to input the text to be identified into a text difficulty classification model and output a text difficulty level of the text to be identified.

[0145] The text difficulty classification model comprises a local recognition network and a chapter recognition network. The local recognition network is configured to acquire local features corresponding to the text to be identified, and the chapter recognition network is configured to acquire chapter features corresponding to the text to be identified.

[0146] In the embodiment of the present application, a text to be identified is acquired, and the text to be identified is input into a text difficulty classification model. The text difficulty classification model comprises a local recognition network and a chapter recognition network. The local recognition network is used to acquire local features corresponding to the text to be identified, and the chapter recognition network is used to acquire chapter features corresponding to the text to be identified. The local recognition network and the chapter recognition network are used to analyze and identify the text to be identified from local to global and in all aspects, and finally output the text difficulty level of the text to be identified. The present application overcomes the defects of the prior art that long-distance dependency cannot be captured and classification is inaccurate, and realizes accurate text difficulty classification of long text.

[0147] According to the text difficulty classification device provided by the present application, the classification unit 52 is specifically configured to:

[0148] extract local features of the text to be identified through the local recognition network;

[0149]

[0150] ​processing the local features through the passage recognition network to obtain passage features of the text to be recognized;

[0151] performing linear transformation and normalization on the passage features to obtain a text difficulty probability distribution;

[0152] determining a text difficulty level of the text to be recognized according to the text difficulty probability distribution, and outputting the text difficulty level of the text to be recognized.

[0153] According to the text difficulty grading device provided by the application, the text difficulty grading model is obtained by the following steps, comprising:

[0154] obtaining a text sample to be recognized and a corresponding real label;

[0155] extracting local feature samples of the text sample to be recognized through an initial local recognition network;

[0156] processing the local feature samples through an initial passage recognition network to obtain passage feature samples of the text sample to be recognized;

[0157] performing linear transformation and normalization on the passage feature samples to obtain text difficulty probability distribution samples;

[0158] calculating a loss function according to the text difficulty probability distribution samples and the real label;

[0159] iteratively updating parameters of the initial local recognition network and parameters of the initial passage recognition network according to the loss function, determining the initial local recognition network after iterative updating as the local recognition network, and determining the initial passage recognition network after iterative updating as the passage recognition network.

[0160] According to the text difficulty grading device provided by the application, the initial local recognition network comprises a variable-length convolution layer and a block structure;

[0161] The extraction of the local feature samples of the text sample to be recognized through the initial local recognition network comprises:

[0162] determining a text sequence sample to be recognized according to the text sample to be recognized;

[0163] performing convolution and splicing on the text sequence sample to be recognized through the variable-length convolution layer to obtain variable-length convolution layer output feature samples;

[0164] performing iterative pooling convolution on the variable-length convolution layer output feature samples through the block structure to obtain feature map samples;

[0165] The channel dimension and the height dimension of the feature pattern sample are exchanged to obtain the local feature sample.

[0166] According to the text difficulty grading device provided in the application, the initial chapter recognition network comprises a bidirectional long short-term memory network.

[0167] The local feature sample is processed by the initial chapter recognition network to obtain a chapter feature sample of the text sample to be recognized.

[0168] The local feature sample is input into the bidirectional long short-term memory network to obtain a plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0169] The chapter feature sample is determined according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0170] According to the text difficulty grading device provided in the application, the chapter feature sample is determined according to the plurality of forward hidden layer vector samples and reverse hidden layer vector samples corresponding to different time points.

[0171] The forward hidden layer vector sample and the reverse hidden layer vector sample corresponding to the same time point are spliced to obtain a corresponding context sequence.

[0172] The context sequence weight is determined according to the context sequence and a preset context vector.

[0173] The chapter feature sample is determined according to the context sequence and the context sequence weight.

[0174] According to the text difficulty grading device provided in the application, the loss function is calculated according to the text difficulty probability distribution sample and a real label corresponding to the text sample to be recognized.

[0175] The real label is smoothed to obtain a smoothed real label.

[0176] The loss function is calculated according to the smoothed real label and the text difficulty probability distribution sample.

[0177] Figure 6 An example of an entity structure diagram of an electronic device is shown in FIG. 1. Figure 6As shown, the electronic device can include a processor 610, a communications interface 620, a memory 630, and a communications bus 640, wherein the processor 610, the communications interface 620, and the memory 630 complete mutual communication through the communications bus 640. The processor 610 can invoke a logic instruction in the memory 630 to execute a text difficulty grading method, which includes: obtaining to-be-recognized text; inputting the to-be-recognized text into a text difficulty grading model to output a text difficulty level of the to-be-recognized text; wherein the text difficulty grading model includes a local recognition network and a chapter recognition network, the local recognition network is used to obtain local features corresponding to the to-be-recognized text, and the chapter recognition network is used to obtain chapter features corresponding to the to-be-recognized text.

[0178] In addition, the logic instruction in the memory 630 described above can be implemented in the form of a software function unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0179] On the other hand, the present application also provides a computer program product, which includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute the text difficulty grading method provided by the above-mentioned method, which includes: obtaining to-be-recognized text; inputting the to-be-recognized text into a text difficulty grading model to output a text difficulty level of the to-be-recognized text; wherein the text difficulty grading model includes a local recognition network and a chapter recognition network, the local recognition network is used to obtain local features corresponding to the to-be-recognized text, and the chapter recognition network is used to obtain chapter features corresponding to the to-be-recognized text.

[0180] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the text difficulty grading method provided by any of the above methods, and the method comprises: obtaining a text to be recognized; inputting the text to be recognized into a text difficulty grading model to output a text difficulty level of the text to be recognized; wherein the text difficulty grading model comprises a local recognition network and a discourse recognition network, the local recognition network is configured to obtain local features corresponding to the text to be recognized, and the discourse recognition network is configured to obtain discourse features corresponding to the text to be recognized.

[0181] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0182] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software plus necessary general hardware platforms, and of course, can also be realized by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0183] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for classifying text difficulty, characterized in that, include: Obtain the text to be recognized; Input the text to be identified into the text difficulty level model and output the text difficulty level of the text to be identified; The text difficulty grading model includes a local recognition network and a document recognition network. The local recognition network is used to obtain the local features corresponding to the text to be recognized, and the document recognition network is used to obtain the document features corresponding to the text to be recognized. The text difficulty rating model is obtained through the following steps: Obtain the text sample to be recognized and its corresponding real label; Local feature samples of the text sample to be identified are extracted using an initial local recognition network; The local feature samples are processed by an initial text recognition network to obtain text feature samples of the text sample to be recognized; The text feature samples are linearly transformed and normalized to obtain text difficulty probability distribution samples; Calculate the loss function based on the text difficulty probability distribution sample and the true label; The parameters of the initial local recognition network and the initial document recognition network are iteratively updated according to the loss function. The iteratively updated initial local recognition network is determined as the local recognition network, and the iteratively updated initial document recognition network is determined as the document recognition network. The initial local recognition network includes variable-length convolutional layers and a block structure. The step of extracting local feature samples of the text sample to be identified through an initial local recognition network includes: Determine the text sequence sample to be identified based on the text sample to be identified; The variable-length convolutional layer is used to convolve and concatenate the text sequence samples to be identified to obtain the output feature samples of the variable-length convolutional layer. The block structure is used to iteratively pool and convolve the output feature samples of the variable-length convolutional layer to obtain feature map samples. The local feature sample is obtained by swapping the channel dimension and height dimension of the feature map sample. The initial text recognition network includes a bidirectional long short-term memory network; The process of processing the local feature samples through an initial document recognition network to obtain document feature samples of the text sample to be recognized includes: The local feature samples are input into the bidirectional long short-term memory network to obtain forward hidden layer vector samples and backward hidden layer vector samples corresponding to multiple time points. The chapter feature samples are determined based on the forward hidden layer vector samples and the reverse hidden layer vector samples corresponding to the multiple time points.

2. The text difficulty classification method according to claim 1, characterized in that, The step of inputting the text to be identified into the text difficulty level model and outputting the text difficulty level of the text to be identified includes: The local recognition network extracts local features of the text to be recognized. The local features are processed by the document recognition network to obtain the document features of the text to be recognized; The text features are linearly transformed and normalized to obtain the text difficulty probability distribution; The text difficulty level of the text to be identified is determined based on the text difficulty probability distribution, and the text difficulty level of the text to be identified is output.

3. The text difficulty classification method according to claim 1, characterized in that, The step of determining the chapter feature samples based on the forward hidden layer vector samples and backward hidden layer vector samples corresponding to the multiple time points includes: By concatenating the forward hidden layer vector samples and the backward hidden layer vector samples corresponding to the same time, the corresponding context sequence is obtained. The context sequence weights are determined based on the context sequence and the preset context vector. The text feature samples are determined based on the context sequence and the context sequence weights.

4. The text difficulty classification method according to claim 1, characterized in that, The step of calculating the loss function based on the text difficulty probability distribution sample and the true label corresponding to the text sample to be identified includes: The real labels are smoothed to obtain smoothed real labels; The loss function is calculated based on the smoothed true labels and the text difficulty probability distribution samples.

5. A text difficulty grading device, characterized in that, include: The acquisition unit is used to acquire the text to be recognized; The grading unit is used to input the text to be identified into the text difficulty grading model and output the text difficulty level of the text to be identified. The text difficulty grading model includes a local recognition network and a document recognition network. The local recognition network is used to obtain the local features corresponding to the text to be recognized, and the document recognition network is used to obtain the document features corresponding to the text to be recognized. The text difficulty rating model is obtained through the following steps: Obtain the text sample to be recognized and its corresponding real label; Local feature samples of the text sample to be identified are extracted using an initial local recognition network; The local feature samples are processed by an initial text recognition network to obtain text feature samples of the text sample to be recognized; The text feature samples are linearly transformed and normalized to obtain text difficulty probability distribution samples; Calculate the loss function based on the text difficulty probability distribution sample and the true label; The parameters of the initial local recognition network and the initial document recognition network are iteratively updated according to the loss function. The iteratively updated initial local recognition network is determined as the local recognition network, and the iteratively updated initial document recognition network is determined as the document recognition network. The initial local recognition network includes variable-length convolutional layers and a block structure. The step of extracting local feature samples of the text sample to be identified through an initial local recognition network includes: Determine the text sequence sample to be identified based on the text sample to be identified; The variable-length convolutional layer is used to convolve and concatenate the text sequence samples to be identified to obtain the output feature samples of the variable-length convolutional layer. The block structure is used to iteratively pool and convolve the output feature samples of the variable-length convolutional layer to obtain feature map samples. The local feature sample is obtained by swapping the channel dimension and height dimension of the feature map sample. The initial text recognition network includes a bidirectional long short-term memory network; The process of processing the local feature samples through an initial document recognition network to obtain document feature samples of the text sample to be recognized includes: The local feature samples are input into the bidirectional long short-term memory network to obtain forward hidden layer vector samples and backward hidden layer vector samples corresponding to multiple time points. The chapter feature samples are determined based on the forward hidden layer vector samples and the reverse hidden layer vector samples corresponding to the multiple time points.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the text difficulty classification method as described in any one of claims 1 to 4.

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

Citation Information

Patent Citations

  • Implicit discourse relation analysis method and system based on discourse structure chart convolution

    CN111695341A

  • Text classification method, apparatus, device, and storage medium

    WO2020244066A1