Text difficulty grading and training method and device, electronic equipment and storage medium
By establishing a difficulty level assessment model and a pre-trained model, the problem of low accuracy in text difficulty level classification has been solved, achieving higher precision in text difficulty level classification and making it easier for users to select suitable reading materials.
Patent Information
- Application Number
- CN202111641248.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2041-12-29
AI Technical Summary
The lack of publicly available difficulty grading standards and corpora containing various difficulty levels in existing technologies leads to low accuracy in text difficulty grading values.
By acquiring the first set of labeled target texts, preprocessing them, and establishing a difficulty grading assessment model, calculating the difficulty pseudo-label values of unlabeled texts, and training the text difficulty grading model in combination with the pre-trained model, a text difficulty grading model is obtained.
It improves the accuracy of text difficulty grading, helping users select suitable reading texts.
Smart Images

Figure CN114491021B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of natural language processing, and particularly relate to a text difficulty grading and training method and device, electronic equipment, and storage medium. BACKGROUND
[0002] In the era of information explosion, the quantity and variety of texts (such as reading materials such as textbooks, magazines, newspapers, etc.) are exponentially increasing. In order to be able to select texts suitable for users of different ages or reading levels from the vast amount of texts, it is necessary to grade the reading difficulty of the texts.
[0003] At present, when grading the reading difficulty of a text to obtain a difficulty grading value corresponding to the text, due to the lack of a public difficulty grading standard and a corpus containing various difficulty levels, the accuracy of the difficulty grading value obtained by using an existing model is low. SUMMARY
[0004] Therefore, embodiments of the present specification provide a text difficulty grading and training method and device, electronic equipment, and storage medium, which can improve the accuracy of text difficulty grading when grading the reading difficulty of a text.
[0005] First, the embodiments of the present specification provide a text difficulty grading training method, comprising:
[0006] obtaining a first target text set that has been labeled, the first target text set containing label data of a difficulty true value corresponding to each text, wherein the first target text set includes a first training text set;
[0007] preprocessing each text in the first target text set to obtain a feature set corresponding to each text in the first training text set;
[0008] establishing a difficulty grading evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient;
[0009] obtaining a second target text set that has not been labeled, and calculating a difficulty pseudo-label value corresponding to each text in the second target text set that has not been labeled according to the difficulty grading evaluation model to obtain a second target text set that has been labeled;
[0010] inputting the first training text set and the second target text set that has been labeled as a second training text set to a pre-set pre-training model, training the pre-training model, and obtaining a text difficulty grading model.
[0011] Optionally, the establishing a difficulty grading evaluation model according to the feature set corresponding to each text in the first training text set comprises:
[0012] Obtaining a reference text set;
[0013] Extracting features of the reference text set, constructing a thesaurus library, and calculating difficulty values corresponding to each feature in the thesaurus library;
[0014] In the thesaurus library, each feature in the feature set corresponding to each text in the first training text set is searched, and the extracting features of the reference text set, constructing a thesaurus library, and calculating difficulty values corresponding to each feature in the thesaurus library include:
[0015] Extracting features of each text in the reference text set, counting the frequency of each feature according to the feature type, and sorting according to the frequency of each feature to obtain the thesaurus library, wherein the thesaurus library includes a dictionary library and a word dictionary library;
[0016] According to the sorting results of the corresponding feature types of the dictionary library and the word dictionary library, respectively, the difficulty values corresponding to each word in the dictionary library and the difficulty values corresponding to each feature in the word dictionary library are determined, and the obtained difficulty values are normalized.
[0017] Optionally, the preprocessing of each text in the first target text set to obtain the feature set corresponding to each text in the first training text set includes:
[0018] Splitting each text in the first target text set to obtain the feature set corresponding to each text in the first training text set, and the feature types in the feature set include at least one of the following: word, word.
[0019] Optionally, the searching for each feature in the feature set corresponding to each text in the first training text set in the thesaurus library, and establishing the difficulty classification evaluation model according to the pre-set weight coefficient, includes:
[0020] In the dictionary library, the words in the feature set corresponding to each text in the first training text set are searched, when the same word is searched, the difficulty value of the corresponding word in the dictionary library is taken as the difficulty value of the word in the feature set corresponding to each text in the first training text set; and when the same word is not searched, the difficulty value of the word in the feature set corresponding to each text in the first training text set is set to 1;
[0021] In the word dictionary library, the words in the feature set corresponding to each text in the first training text set are searched, when the same word is searched, the difficulty value of the corresponding word in the word dictionary library is taken as the difficulty value of the word in the feature set corresponding to each text in the first training text set; and when the same word is not searched, the difficulty value of the word in the feature set corresponding to each text in the first training text set is set to 1;
[0022] respectively, and according to the number of words and the number of characters in the feature set corresponding to each text in the first training text set and the difficulty value corresponding to each word and each word, the difficulty average value of the words and the words in the feature set corresponding to each text in the first training text set is calculated, and according to the pre-set weight coefficient, the difficulty classification evaluation model is established, and the difficulty classification evaluation model is adjusted, wherein the difficulty classification evaluation model is:
[0023] L = a * W av * W n + b * V av * V n ;
[0024] Wherein, L is used to represent the difficulty evaluation value of the text; W av is used to represent the difficulty average value of all words in the feature set corresponding to the text; W n is used to represent the number of all words in the feature set corresponding to the text; V av is used to represent the difficulty average value of all words in the feature set corresponding to the text; V n is used to represent the number of all words in the feature set corresponding to the text; a is used to represent the weight coefficient of the word, and b is used to represent the weight coefficient of the word.
[0025] Optionally, the adjustment of the difficulty classification evaluation model further comprises:
[0026] According to the number of all words and the number of all words in the feature set corresponding to each text in the first training text set, and the difficulty classification evaluation model, the difficulty pseudo-label value corresponding to each text in the first training text set is obtained, and the difficulty label value corresponding to each text is normalized to the difficulty true value corresponding to each text as the difficulty evaluation value.
[0027] The number of words and the number of words in the feature set corresponding to each text in the first training text set, and the average value of the words and the average value of the words are brought into the difficulty classification evaluation model, the difficulty pseudo-label value corresponding to each text in the first training text set is obtained, and the difficulty label value corresponding to each text is normalized to the difficulty true value corresponding to each text as the difficulty evaluation value.
[0028] The difficulty average value of the first m difficulty value of the first training text set in each text is calculated as the difficulty average value of the first m word of the text, and the difficulty average value of the first n word difficulty value of the text is calculated as the difficulty average value of the first n word of the text.
[0029] the average difficulty value of the first m characters of each text in the first training text set is greater than or equal to a first preset threshold value, the average difficulty value of the first n words of each text in the first training text set is greater than or equal to a second preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a first preset difficulty prediction range value, the difficulty label value calculated by the difficulty grading evaluation model is added with a first preset difficulty label value;
[0030] wherein m and n are integers greater than 1.
[0031] Optionally, the feature types in the feature set corresponding to each text in the first training text set further include a sentence.
[0032] The adjusting of the difficulty grading evaluation model further includes:
[0033] calculating the number of sentences and the average length of sentences in the first training text set;
[0034] when the average length of sentences is greater than or equal to a third preset threshold value, the number of sentences is greater than or equal to a fourth preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a second preset difficulty label value, the difficulty label value calculated by the difficulty grading evaluation model is set to a second preset difficulty label value.
[0035] when the average length of sentences is less than or equal to a fifth preset threshold value, the number of sentences is less than or equal to a sixth preset threshold value, and the difficulty evaluation value of each text in the first training text set is greater than a third preset difficulty label value, the difficulty label value calculated by the difficulty grading evaluation model is set to a third preset difficulty label value.
[0036] Optionally, before the splitting of each text in the first target text set to obtain the feature set corresponding to each text in the first training text set, the method further includes:
[0037] filtering each text in the first target text set according to a target text requirement.
[0038] Optionally, the obtaining of the unlabeled second target text set and the calculating of the difficulty pseudo-label value of each text in the unlabeled second target text set according to the difficulty grading evaluation model to obtain the labeled second target text set includes:
[0039] splitting each text in the unlabeled second target text set to obtain a feature set corresponding to each text in the unlabeled second target text set, wherein the feature types in the feature set include at least one of the following: a character and a word.
[0040] obtaining the difficulty value of each character and the difficulty value of each word of each text in the second target text set according to the lexicon library.
[0041] respectively, and according to the difficulty values of the words and the difficulty values of the phrases, obtain the difficulty average values of the words and the difficulty average values of the phrases of each text in the second target text set;
[0042] input all the word numbers and the difficulty average values of the words and all the phrase numbers and the difficulty average values of the phrases of each text in the second target text set into the difficulty grading evaluation model, to obtain the difficulty evaluation values of each text in the second target text set;
[0043] normalize the difficulty evaluation values of each text in the second target text set according to the difficulty evaluation value sizes of each text in the second target text set, to obtain the difficulty pseudo-label values of each text in the second target text set.
[0044] Optionally, the preset pre-training model comprises an encoding layer and a multi-layer perceptron network layer coupled with the encoding layer.
[0045] Optionally, the inputting the first training text set and the labeled second target text set into the preset pre-training model for training to obtain the text difficulty grading model comprises:
[0046] input the labeled second target text set into the encoding layer, and convert the labeled second target text set into a corresponding feature vector by the encoding layer, wherein the feature vector is obtained in the following manner: input the word vector and the position vector of the labeled second target text into the encoding layer, and obtain the output corresponding to the first vector as the feature vector representation of the entire text;
[0047] input the feature vector into the multi-layer perceptron network layer, and predict the labeled second target text set according to the feature vector by the multi-layer perceptron network layer, to obtain the difficulty prediction values of each text in the labeled second target text set;
[0048] construct a loss function based on the difficulty prediction values of each text in the second target text set and the difficulty pseudo-label values thereof, and update the parameters of the encoding layer and the multi-layer perceptron network layer according to the loss function, to obtain an initial text difficulty grading model;
[0049] selecting part of the labeled second target text set and inputting the first training text set and the labeled second target text set into the initial text difficulty grading model, outputting, by the multi-layer perceptron network layer, a difficulty prediction value corresponding to each text in the part of the labeled second target text set and the first training text set;
[0050] Based on the difficulty prediction value and the difficulty pseudo-label value of each text in part of the labeled second target text set, and the difficulty prediction value and the difficulty true value corresponding to each text in the first training text set, a loss function is constructed, and the parameters of the initial text difficulty grading model are updated according to the loss function, to obtain the text difficulty grading model.
[0051] Optionally, before the first training text set and the labeled second target text set are input into the preset pre-training model as a second training text set, the pre-training model is trained to obtain a text difficulty grading model, the method further comprises:
[0052] establishing a mapping relationship between the difficulty true value corresponding to each text in the first training text set, the difficulty true value corresponding to each text in the second target text set, and the segmentation label value;
[0053] The first training text set and the labeled second target text set are input into the preset pre-training model as a second training text set, the pre-training model is trained to obtain a text difficulty grading model, comprising:
[0054] inputting the labeled second target text set into the encoding layer, and converting the labeled second target text set into a corresponding feature vector by the encoding layer, wherein the feature vector is obtained in the following manner: inputting the word vector and the position vector of the labeled second target text into the encoding layer, and obtaining the output corresponding to the first vector as the feature vector representation of the entire text;
[0055] inputting the feature vector into the multi-layer perceptron network layer, and predicting, by the multi-layer perceptron network layer, the labeled second target text set according to the feature vector to obtain a difficulty prediction value of each text in the labeled second target text set, and obtaining a segmentation label prediction value corresponding to each text in the labeled second target text set based on the mapping relationship;
[0056] Based on the difficulty prediction value, the difficulty pseudo-label value, the segmentation label value, and the segmentation label prediction value of each text in the second target text set, a loss function is constructed, and the parameters of the encoding layer and the multi-layer perceptron network layer are updated according to the loss function to obtain an initial text difficulty grading model;
[0057] part of the labeled second target text set and the first training text set into the initial text difficulty grading model, outputting, by the multi-layer perceptron network layer, a difficulty prediction value corresponding to each text in part of the labeled second target text set and each text in the first training text set, and respectively obtaining, according to the mapping relationship, a segmentation prediction value corresponding to each text in part of the labeled second target text set and each text in the first training text set;
[0058] Based on the difficulty prediction value, the segmentation prediction value, the segmentation label value corresponding to each text in part of the labeled second target text set and the first training text set, and the difficulty label value corresponding to each text in the labeled second target text set and the difficulty true value corresponding to each text in the first training text set, a loss function is constructed, and the parameters of the initial text difficulty grading model are updated according to the loss function to obtain the text difficulty grading model.
[0059] The embodiments of the present specification also provide a text difficulty grading method, comprising:
[0060] Obtaining a text to be graded;
[0061] Inputting the text to be graded into a text difficulty grading model to obtain a difficulty value of the text to be graded and outputting the difficulty value;
[0062] The text difficulty grading model is obtained by inputting a first training text set and a labeled second target text set as a second training text set into a preset pre-training model, and training the pre-training model, wherein the first training text set comprises label data corresponding to a difficulty true value of each text; the difficulty pseudo label value of the labeled second target text set is obtained according to a difficulty grading evaluation model; and the difficulty grading evaluation model is obtained according to a feature set corresponding to each text in the first training text set and a pre-set weight coefficient.
[0063] Optionally, the text difficulty grading model comprises an encoding layer and a multi-layer perceptron network layer.
[0064] The inputting the text to be graded into a text difficulty grading model to obtain a difficulty value of the text to be graded and outputting the difficulty value comprises:
[0065] Inputting the text to be graded into the encoding layer, and converting, by the encoding layer, the text to be graded into a corresponding feature vector, wherein the feature vector is obtained in the following manner: inputting a word vector and a position vector of the text to be graded into the encoding layer, and obtaining an output corresponding to a first position vector as a feature vector representation of the entire text.
[0066] inputting the feature vector into the multilayer perceptron network layer, and obtaining the difficulty value of the text to be classified by the multilayer perceptron network layer based on the feature vector of the text to be classified and outputting the difficulty value.
[0067] Correspondingly, the embodiments of the present specification also provide a text difficulty classification training device, comprising:
[0068] a first target text set obtaining module adapted to obtain a first target text set with labels, wherein the first target text set comprises a difficulty real value corresponding to each text, and the first target text set comprises a first training text set;
[0069] a preprocessing module adapted to preprocess each text in the first target text set to obtain a feature set corresponding to each text in the first training text set;
[0070] a difficulty classification evaluation model construction module adapted to construct a difficulty classification evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient;
[0071] a second target text set obtaining module adapted to obtain a second target text set without labels;
[0072] a difficulty label value calculation module adapted to calculate a difficulty real value corresponding to each text in the second target text set without labels to obtain a second target text set with labels;
[0073] a training module adapted to input the first training text set and the second target text set with labels into a pre-set pre-training model as a second training text set, train the pre-training model, and obtain a text difficulty classification model.
[0074] Correspondingly, the embodiments of the present specification also provide a text difficulty classification device, comprising:
[0075] a text obtaining module adapted to obtain a text to be classified;
[0076] a processing module adapted to input the text to be classified into a text difficulty classification model, obtain a difficulty value of the text to be classified, and output the difficulty value;
[0077] The text difficulty grading model is obtained by inputting a first training text set, a labeled second target text set as a second training text set into a preset pre-training model, and training the pre-training model, wherein the first training text set comprises label data of a difficulty real value corresponding to each text; the difficulty pseudo label value of the labeled second target text set is obtained according to an established difficulty grading evaluation model; and the difficulty grading evaluation model is obtained according to a feature set corresponding to each text in the first training text set and a preset weight coefficient.
[0078] The electronic device provided in the embodiments of the present specification includes a memory and a processor, wherein the memory is adapted to store one or more computer instructions, and the processor executes the computer instructions to perform the steps of the training method according to any one of the preceding embodiments or the steps of the grading method according to any one of the preceding embodiments.
[0079] The computer readable storage medium provided in the embodiments of the present specification has computer instructions stored thereon, and the computer instructions perform the steps of the training method according to any one of the preceding embodiments or the steps of the grading method according to any one of the preceding embodiments when executed.
[0080] The text difficulty grading training scheme according to the embodiments of the present specification can process the unlabeled second target text set by establishing a difficulty grading evaluation model, obtain the labeled second target text set with a difficulty pseudo label value, increase the training corpus of the preset pre-training model, obtain a text difficulty grading model with higher difficulty grading precision compared to existing models by using more training corpus with a difficulty pseudo label value, and thus improve the accuracy of text difficulty grading when the text difficulty grading model is used to grade the text difficulty, and facilitate users to select suitable reading texts.
[0081] Further, by obtaining a reference text set, extracting features of each text in the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to each feature in the lexicon library, each feature in the lexicon library can have a corresponding difficulty value; and by searching each feature in the feature set corresponding to each text in the first training text set in the lexicon library and according to the preset weight coefficient, the difficulty grading evaluation model can be established, the corpus used to construct the difficulty grading evaluation model can be quickly expanded, and the accuracy of the difficulty grading evaluation model can be improved.
[0082] Furthermore, features of each text in the reference text set are extracted, the frequency of each feature is counted according to feature type, and the features are sorted according to their frequency to obtain the lexicon, which includes a dictionary and a thesaurus. Based on the sorting results of the corresponding feature types in the dictionary and the thesaurus, the difficulty value corresponding to each character in the dictionary and the difficulty value corresponding to each feature in the thesaurus are determined, and the obtained difficulty values are normalized. By establishing a dictionary and thesaurus and setting difficulty values for characters and words according to their frequency, the difficulty values corresponding to different feature types under multiple dimensions of the reference text can be obtained. Furthermore, by calculating the difficulty values corresponding to different feature types, the obtained difficulty values are more accurate, thereby improving the accuracy of the difficulty level assessment model. Attached Figure Description
[0083] To more clearly illustrate the technical solutions of the embodiments of this specification, the drawings used in the description of the embodiments of this specification or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0084] Figure 1 A flowchart of a difficulty-level training method is shown in an embodiment of this specification;
[0085] Figure 2 A flowchart illustrating a method for establishing a difficulty level assessment model in an embodiment of this specification is shown;
[0086] Figure 3 This document illustrates a flowchart of a method for establishing a difficulty level assessment model in a specific application scenario according to an embodiment of this specification.
[0087] Figure 4 A flowchart illustrating a method for obtaining a second target text set with annotation information, as described in an embodiment of this specification, is shown.
[0088] Figure 5 A flowchart illustrating a training method for a text difficulty grading model in an embodiment of this specification is shown.
[0089] Figure 6 A flowchart of a text difficulty grading method according to an embodiment of this specification is shown;
[0090] Figure 7 This specification shows a schematic diagram of the structure of a text difficulty level training device according to an embodiment of the present specification;
[0091] Figure 8 A schematic diagram of a text difficulty grading device according to an embodiment of this specification is shown;
[0092] Figure 9 A structural schematic diagram of an electronic device is shown in an embodiment of the present specification. DETAILED DESCRIPTION
[0093] As described in the background, at present, when the reading difficulty of a text is classified, due to the lack of a public difficulty classification standard and a corpus containing various difficulty levels, the accuracy of the difficulty classification value obtained by using an existing model is low.
[0094] To solve the above problems, the text difficulty classification training method provided in the present specification is adopted, which includes: obtaining an annotated first target text set, the first target text set containing label data of a difficulty true value corresponding to each text, wherein the first target text set includes a first training text set; preprocessing each text in the first target text set to obtain a feature set corresponding to each text in the first training text set; establishing a difficulty classification evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient; obtaining an unannotated second target text set, and calculating a difficulty pseudo-label value corresponding to each text in the unannotated second target text set according to the difficulty classification evaluation model to obtain an annotated second target text set; inputting the first training text set and the annotated second target text set as a second training text set to a pre-set pre-training model, training the pre-training model, and obtaining a text difficulty classification model.
[0095] By establishing a difficulty classification evaluation model, the unannotated second target text set is processed, and an annotated second target text set with a difficulty pseudo-label value is obtained, which increases the training corpus of the pre-set pre-training model. Compared with the existing model, by using more training corpus with a difficulty pseudo-label value, a text difficulty classification model with higher difficulty classification precision can be obtained, so that when the text difficulty classification model is used to classify the difficulty of a text, the accuracy of the text difficulty classification can be improved, and it is convenient for users to select suitable reading texts.
[0096] To enable those skilled in the art to better understand and implement the embodiments of the present specification, the following is described in detail with reference to the accompanying drawings and through specific application examples.
[0097] In the embodiments of the present specification, in order to obtain the difficulty value of a text and facilitate users to select suitable reading texts, a training corpus with difficulty information can be established first, and the pre-set pre-training model is trained using the obtained training corpus to obtain a text difficulty classification model, and the text difficulty classification model obtained by training can be used to judge the difficulty of a text.
[0098] Reference Figure 1The text difficulty grading training method shown in the embodiments of the present specification can be performed according to the following steps in some embodiments of the present specification:
[0099] S10, obtaining an annotated first target text set, the first target text set containing label data of difficulty true values corresponding to each text.
[0100] The target text set can include a first training text set.
[0101] In a specific implementation, the annotated first target text set can be obtained from any text with difficulty value label data on the Internet.
[0102] In terms of user objects, if the user is a student, the annotated first target text set can be a textbook for each grade. For different subjects or languages, the textbook can be a Chinese text or a non-Chinese text, for example, an English text. The textbook can be obtained from each textbook publisher or from a reader matched with each grade. The embodiments of the present specification do not limit the specific obtaining method, as long as the target text with the required difficulty value label data can be obtained.
[0103] S11, preprocessing each text in the first target text set to obtain a feature set corresponding to each text in the first training text set.
[0104] Specifically, since the first target text set contains label data of difficulty true values corresponding to each text, by preprocessing the first target text set, features related to text difficulty values can be obtained, which facilitates subsequent pre-training of the model to learn the relationship between text difficulty and its features.
[0105] S12, establishing a difficulty grading evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient.
[0106] In a specific implementation, when obtaining the feature set corresponding to each text in the first training text set, the difficulty value of each feature in the feature set can be configured, and the difficulty grading evaluation model can be established according to the correspondence between the feature and the feature difficulty value and the pre-set weight coefficient.
[0107] S13, obtaining an unannotated second target text set, and calculating a pseudo-label value of the difficulty of each text in the unannotated second target text set according to the difficulty grading evaluation model to obtain an annotated second target text set.
[0108] Specifically, through the above steps S11 to S12, a difficulty grading evaluation model for evaluating the difficulty of a text can be obtained, and the difficulty pseudo-label value of the unlabeled second target text set can be obtained by using the difficulty grading evaluation model, and the labeled second target text set can be obtained.
[0109] S14, inputting the first training text set and the labeled second target text set into a preset pre-training model as a second training text set, training the pre-training model to obtain a text difficulty grading model.
[0110] In a specific implementation, each text in the first training text set and the labeled second target text set can be sequentially input into a preset pre-training model, the pre-training model can be trained, and the parameters in the pre-training model can be updated based on the predicted value of each text output by the pre-training model and the real value corresponding to the predicted value, and finally a text difficulty grading model can be obtained. After that, the text difficulty grading model can be used to predict the difficulty value of other texts, and the reading difficulty level of the text can be determined based on the difficulty value.
[0111] The text difficulty grading training scheme of the embodiments of the present specification can process the unlabeled second target text set by establishing a difficulty grading evaluation model, obtain the labeled second target text set with difficulty label values, increase the training corpus of the preset pre-training model, and obtain a text difficulty grading model with higher difficulty grading precision compared to existing models by using more training corpus with difficulty pseudo-label values. Therefore, when the text difficulty grading model is used to grade the text difficulty, the accuracy of the text difficulty grading can be improved, and the user can select suitable reading texts.
[0112] To enable those skilled in the art to better understand and implement the embodiments of the present specification, the following describes how to implement the text difficulty grading training method through specific application scenarios.
[0113] First, for step S10, some implementable manners are shown.
[0114] In some embodiments of the present specification, the label data of the difficulty real value corresponding to each text in the first target text set can be obtained by manual labeling, or the corresponding labeling rules can be set to automatically label each text in the first text set.
[0115] As a specific example, the obtained first target text set can be textbook texts of each grade, and the textbook texts can be manually annotated according to specific grade information (grade 1 to grade 12) and specific semester information (first semester and second semester) corresponding to the textbook texts. For example, the difficulty real value of the textbook text of the first semester of grade 1 can be set as 1, the difficulty real value of the textbook text of the second semester of grade 1 can be set as 2, and so on, and the difficulty real value corresponding to the second semester of grade 12 can be set as 24, wherein the greater the difficulty real value, the higher the reading difficulty of the text.
[0116] For example, only the specific grade information and the specific semester information corresponding to the textbook text are needed to be obtained, and the specific grade information and the specific semester information are input into a corresponding difficulty real value calculation formula, for example, formula (1), and the difficulty real value corresponding to each textbook text can be automatically obtained.
[0117] As a specific example, when the textbook text is obtained, the specific grade information and the specific semester information corresponding to each textbook text can be obtained, and the difficulty real value thereof can be calculated according to the following difficulty real value calculation formula:
[0118] S = (C - 1) * 2 + T (1)
[0119] Wherein, S is used to represent the difficulty real value corresponding to the textbook text; C is used to represent the grade information corresponding to the textbook text; and T is used to represent the semester information corresponding to the textbook text.
[0120] It can be understood that the above-mentioned annotation process of the first target text set containing the difficulty value corresponding to each text is only an example for illustration, and the first target text set in the embodiments of the present specification can be other types of annotated texts in addition to the textbook texts in the above-mentioned example, for example, the first target text set can also be a reading text material of a middle school entrance examination or a college entrance examination, a well-known newspaper text, a famous literary work, etc.
[0121] In a specific implementation, the first target text set can include a first training text set, and the first training text set can be used to construct a difficulty grading evaluation model and as a corpus of a pre-trained model for training.
[0122] In a specific application, the text with the difficulty real value can be used to evaluate the accuracy of the obtained difficulty grading evaluation model, and therefore, in some embodiments of the present specification, the first target text set can also include a test text set, and the test text set can be used to evaluate the accuracy of the difficulty grading evaluation model.
[0123] For step S11, some optional examples are given below.
[0124] In a specific application, a feature set for measuring the reading difficulty level can be constructed from the language level of each text in the first target text set, so that the reading difficulty of each text in the first target text set can be represented from different dimensions of features.
[0125] In some embodiments of the specification, each text in the first target text set is split to obtain each text in the first training text set, and the feature types in the feature set include at least one of the following: word, character.
[0126] For example, when a sentence of one of the texts in the first target text set is {I am Chinese}, the sentence can be segmented to obtain {I am Chinese}; when a sentence of one of the texts in the first target text set is {I am Chinese}, the sentence can be segmented to obtain {I am Chinese}.
[0127] Similarly, the feature set corresponding to each text in the first training text set can be obtained according to the above segmentation method.
[0128] For step S12, some specific implementation examples are given below.
[0129] After the above segmentation processing, the difficulty values of each feature in the feature set can be set, and a difficulty classification evaluation model can be established. Since the number of texts in the first training text set is small, if the difficulty values of each feature are directly set according to the frequency of each feature in the feature types of all texts in the first training text set, the difficulty values of some features may be much larger or much smaller than their actual difficulty values, which may affect the accuracy of the difficulty classification evaluation model established.
[0130] In a specific implementation, before setting the difficulty values of each feature in the feature set corresponding to each text in the first training text set, a large number of reference texts can be obtained, and features related to the difficulty values in the reference texts can be extracted to establish a lexicon library. Based on the lexicon library, the difficulty values of each feature in the feature set corresponding to each text in the first training text set are determined, and then a difficulty classification evaluation model is established, which can quickly expand the corpus used to construct the difficulty classification evaluation model and improve the accuracy of the difficulty classification evaluation model.
[0131] Referring to Figure 2 The flowchart of the method for establishing a difficulty classification evaluation model in an embodiment of the specification, in some embodiments of the specification, can be performed according to the following steps:
[0132] S20, obtaining a reference text set.
[0133] In a specific implementation, the reference text set can be derived from any unlabeled text on the Internet. For example, a large amount of text can be obtained from various libraries and book websites to serve as the reference text set. Meanwhile, the reference text set can be updated with new text or removed with outdated text over time to ensure the timeliness of the texts in the reference text set.
[0134] It can be understood that, in the process of obtaining the reference text set, some content irrelevant to the content of the text, such as a watermark and a signature, can be directly removed.
[0135] S21, extracting features in the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to the features in the lexicon library.
[0136] As a specific example, the reference text set can be segmented and split according to the segmentation and splitting processing manner described in the foregoing embodiments, to obtain a plurality of features in the reference text set, and a lexicon library can be constructed according to the plurality of features, and difficulty values corresponding to the features in the lexicon library can be calculated, to provide a solid corpus resource basis for subsequent text construction.
[0137] S22, searching for each feature in a feature set corresponding to each text in the first training text set in the lexicon library, and establishing the difficulty classification evaluation model according to the pre-set weight coefficient.
[0138] In a specific implementation, since the number of the reference text set is much larger than the number of the first training text set, the features in the lexicon library can contain features of all texts in the first training text set, and through matching operations, difficulty values corresponding to each feature in the feature set corresponding to each text in the first training text set can be obtained, and the difficulty classification evaluation model can be established based on the obtained difficulty values.
[0139] In a specific implementation, the difficulty values corresponding to the features in the lexicon library can be obtained based on a plurality of factors. In some embodiments of the present specification, the frequency of feature occurrence can be used as a factor for measuring the difficulty of the features. In a specific application, the difficulty values of the features can be determined according to the frequency of feature occurrence, and the greater the frequency of feature occurrence, the smaller the difficulty.
[0140] In some embodiments of the present specification, as a specific example, features of each text in the reference text set can be extracted, the frequency of each feature occurrence can be counted according to the feature type, and the frequency of each feature occurrence can be sorted to obtain the lexicon library, wherein the lexicon library includes a dictionary library and a word dictionary library.
[0141] Determine the difficulty values corresponding to each character in the dictionary library and the difficulty values corresponding to each feature in the thesaurus library respectively according to the sorting results under the corresponding feature types in the dictionary library and the thesaurus library, and normalize the obtained difficulty values respectively.
[0142] In a specific implementation, character features and word features of each text in the reference text set can be extracted, a thesaurus library containing all word features and a dictionary library of character features can be constructed, and according to the frequency of occurrence of each character in the dictionary library, a difficulty value is set for each character, and the obtained difficulty value is normalized; according to the frequency of occurrence of each word in the thesaurus library, a difficulty value is set for each word, and the obtained difficulty value is normalized.
[0143] For ease of understanding, the following takes the determination of the difficulty value of a character as an example for illustration.
[0144] As a specific example, if there are 10,000 characters in the dictionary library, among which, the frequency corresponding to "了" is the highest, which is 500, the frequency corresponding to "牖" is the lowest, which is 1, and the frequencies corresponding to the remaining 9,998 characters are between 2 and 499. Among them, the greater the frequency of occurrence of a character, the lower the corresponding difficulty. According to the frequency of occurrence of the characters, the difficulty values of the 10,000 characters are set from the difficulty value range [0, 1].
[0145] For example, the difficulty value of the first character (i.e., "了") can be set to 0, the difficulty value of the character at the 10,000th position (i.e., "牖") can be set to 1, and the difficulty values of the remaining characters are set in sequence according to their frequencies of occurrence.
[0146] It can be understood that the above is an example illustration with 10,000 different characters in the corpus. In a specific implementation, the more types of characters included in the corpus, the more accurate the obtained difficulty value.
[0147] For other features in the thesaurus library, such as words, the process of determining the difficulty value of a character can be referred to, which will not be elaborated here.
[0148] However, for the difficulty value of a sentence, it can be set according to the length and number of sentences. Among them, the longer the sentence and the more the number, correspondingly, it can be considered that the difficulty value of this sentence is greater.
[0149] By establishing a dictionary library and a thesaurus library, and setting difficulty values for them respectively according to the frequencies of characters and words, the difficulty values corresponding to different feature types in multiple dimensions of the reference text can be obtained, and by calculating the difficulty values corresponding to different feature types, the obtained difficulty values are more accurate, thereby improving the accuracy of the difficulty grading evaluation model.
[0150] In some other embodiments, the corpus in the embodiments of this specification can also be constructed based on existing corpora and hierarchical word lists, and different difficulty values can be set for them according to the arrangement order of characters and words.
[0151] According to the above method, the difficulty value corresponding to each character in the dictionary library and the feature value corresponding to each word in the dictionary library can be determined. The difficulty value corresponding to the character can be regarded as the true difficulty value of the character, and the difficulty value corresponding to the word can be regarded as the true difficulty value of the word. Other texts can match the features in the dictionary library and the dictionary library, and when the match is successful, the difficulty value of this feature in the dictionary library and / or the dictionary library is used as the difficulty value of the corresponding feature in the text, and thus a difficulty grading evaluation model can be established.
[0152] In some embodiments of this specification, referring to Figure 3 the flowchart of the method for establishing a difficulty grading evaluation model in a specific application scenario in the embodiments of this specification shown in
[0153] S30. In the dictionary library, retrieve the characters in the feature sets corresponding to each text in the first training text set. When the same character is retrieved, use the difficulty value of the corresponding character in the dictionary library as the difficulty value of the characters in the feature sets corresponding to each text in the first training text set; when the same character is not retrieved, set the difficulty value of the characters in the feature sets corresponding to each text in the first training text set to 1.
[0154] In the embodiments of this specification, the characters and words in the feature set corresponding to the text are used as the features for measuring the text difficulty. After splitting each text in the first training text set, the character features corresponding to each text can be obtained. By retrieving the character features corresponding to each text in the dictionary library, when the same character is retrieved, the difficulty value of the corresponding character in the dictionary library can be used as the difficulty value of the characters in the feature sets corresponding to each text in the first training text set.
[0155] As a specific example, the same character '了' appears in the dictionary library and the feature sets corresponding to at least one text in the first training text set. As can be seen from the above, the difficulty value of the character '了' in the first training text set can be set to 0.
[0156] For some characters in the first training text set, the dictionary library may not contain these characters, indicating that the number of occurrences of these characters in the text is small and their difficulty values are large. The difficulty values of these characters can be set to 1.
[0157] S31, in the dictionary library, searching the words in the feature set corresponding to each text in the first training text set and each word in the dictionary library, when the same word is searched, taking the difficulty value of the corresponding word in the dictionary library as the difficulty value of the word in the feature set corresponding to each text in the first training text set; and when the same word is not searched, setting the difficulty value of the word in the feature set corresponding to each text in the first training text set as 1.
[0158] Specifically, after the splitting processing of each text in the first training text set, the word features corresponding to each text can be searched in the dictionary library, and when the same word is searched, the difficulty value of the corresponding word in the dictionary library can be taken as the difficulty value of the word in the feature set corresponding to each text in the first training text set.
[0159] For some words in the first training text set, the dictionary library may not contain the part of the words, which means that the number of times of the part of the words appearing in the text is less, and the difficulty value is larger, which can be set to 1.
[0160] S32, respectively, the number of words and the number of words in the feature set corresponding to each text in the first training text set are counted.
[0161] S33, according to the number of words and the number of words in the feature set corresponding to each text in the first training text set, and the difficulty value corresponding to each word and each word, the difficulty average value of the word and the word in the feature set corresponding to each text in the first training text set is calculated, and the difficulty classification evaluation model is established according to the pre-set weight coefficient, and the difficulty classification evaluation model is adjusted.
[0162] In specific implementation, by using steps S30 to S32, the difficulty value corresponding to each word and each word in the feature set corresponding to each text in the first training text set can be obtained, then the number of words and the number of words in the feature set corresponding to each text in the first training text set are counted, and the difficulty average value corresponding to all words and the difficulty average value corresponding to all words in the feature set corresponding to each text are calculated, and the difficulty classification evaluation model is established according to the pre-set weight coefficient.
[0163] Among them, the difficulty classification evaluation model can be L:
[0164] L = a * W av * W n + β * V av * V n (2)
[0165] Among them, L is used to represent the difficulty evaluation value of the text; W av is used to represent the difficulty average value of all words in the feature set corresponding to the text; Wn a number of words in the feature set corresponding to the text; V av an average value of difficulty of all words in the feature set corresponding to the text; V n a number of words in the feature set corresponding to the text; a weight coefficient of a word is represented by a, and a weight coefficient of a word is represented by b.
[0166] Specifically, if the text is a text in the first training text set, W av , W n , V av , V n is a factor related to the text in the first training text set; if it is other text, the above factors are related to other text.
[0167] In specific implementation, if the difficulty evaluation value of other text (for example, each text in the second text set) is directly calculated by using the difficulty grading evaluation model, the text difficulty evaluation value obtained may deviate from the true difficulty value. Since each text in the first training text set has a true difficulty value, the difficulty evaluation value of each text in the first training text set can be calculated according to formula (2), and the difficulty grading evaluation model is adjusted by comparing the true difficulty value and the difficulty evaluation value of each text in the first training text set, so as to improve the evaluation accuracy.
[0168] In the embodiments of the present specification, the adjustment of the difficulty grading evaluation model comprises:
[0169] the number of words and the number of words in the feature set corresponding to each text in the first training text set, and the average value of words and the average value of words are brought into the difficulty grading evaluation model to obtain the difficulty label value corresponding to each text in the first training text set, and the difficulty label value corresponding to each text is normalized to the true difficulty value corresponding to each text as a difficulty evaluation value;
[0170] The difficulty average value of the first m largest difficulty values of each text in the first training text set is calculated as the difficulty average value of the first m words of each text, and the difficulty average value of the first n largest difficulty values of each text is calculated as the difficulty average value of the first n words of each text.
[0171] When the difficulty average value of the first m words of each text is greater than or equal to a first preset threshold value, the difficulty average value of the first n words of each text is greater than or equal to a second preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a first preset difficulty prediction range value, the difficulty label value calculated by the difficulty grading evaluation model is added by a first preset difficulty label value;
[0172] wherein m and n are integers greater than 1.
[0173] For example, as a specific example, assuming that the difficulty true value range of each text is 1 to 24, and the difficulty label value range of the text obtained by the difficulty grading evaluation model is M to N, M to N can be normalized to 1 to 24 for easy comparison between the two, where N is greater than M, and N and M are greater than 0.
[0174] Since the word and the word are the features for measuring the difficulty value of the text, the difficulty of the text can be evaluated by calculating the difficulty value of the word and the word. Specifically, the difficulty average value of the first m difficulty value maximum word of each text in the first training text set can be calculated as the difficulty average value of the first m word of each text, and the difficulty average value of the first n difficulty value maximum word of each text can be calculated as the difficulty average value of the first n word of each text.
[0175] Then, the obtained difficulty grading evaluation model is adjusted according to the corresponding adjustment condition.
[0176] Specifically, when the difficulty average value of the first m word of each text is greater than or equal to a first preset threshold, the difficulty average value of the first n word is greater than or equal to a second preset threshold, and the difficulty evaluation value of each text in the first training text set is less than a first preset difficulty prediction range value, the difficulty label value calculated by the difficulty grading evaluation model is added to a first preset difficulty label value.
[0177] Through the above adjustment method, the situation that the difficulty evaluation value obtained by the difficulty grading evaluation model is much smaller than the true difficulty of the text can be avoided.
[0178] In specific implementation, the sizes of m, n, the first preset threshold, the second preset threshold, and the first preset difficulty prediction range value involved in the above adjustment process can be set according to actual conditions.
[0179] It should be noted that if the difficulty label value corresponding to each text in the first training text set is normalized to obtain a decimal difficulty evaluation, an integer operation can be performed on it, for example, a rounding operation can be performed on the obtained difficulty label value to obtain an integer value.
[0180] In addition to adjusting the parameter size of the difficulty grading evaluation model according to the difficulty value of the word and the word in the embodiments of the present specification, the parameter size of the difficulty grading evaluation model can also be adjusted using sentences.
[0181] In specific implementation, the feature type in the feature set corresponding to each text in the first training text set also includes a sentence.
[0182] The adjustment of the difficulty grading evaluation model also includes calculating the number of sentences and the average length of the sentences in the first training text set.
[0183] when the average length of the sentences is greater than or equal to a third preset threshold value, the number of the sentences is greater than or equal to a fourth preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a second preset difficulty label value, the difficulty label value calculated by the difficulty grading evaluation model is set to the second preset difficulty label value;
[0184] when the average length of the sentences is less than or equal to a fifth preset threshold value, the number of the sentences is less than or equal to a sixth preset threshold value, and the difficulty evaluation value of each text in the first training text set is greater than a third preset difficulty label value, the difficulty label value calculated by the difficulty grading evaluation model is set to the third preset difficulty label value.
[0185] As a specific example, when the number of sentences of each text in the first text set is greater than or equal to 70 and the average length of the sentences is greater than or equal to 30, and the difficulty evaluation value of each text in the first training text set is less than 18, the difficulty label value calculated by the difficulty grading evaluation model can be set to 18;
[0186] when the number of sentences of each text in the first text set is less than or equal to 30 and the average length of the sentences is less than or equal to 15, and the difficulty evaluation value of each text in the first training text set is greater than 10, the difficulty label value calculated by the difficulty grading evaluation model can be set to 10.
[0187] It can be understood that the difficulty grading evaluation model adjustment process described above is only an example for illustration. In specific implementation, the sizes of the third preset threshold value, the fourth preset threshold value, the second preset difficulty label value, the fifth preset threshold value, the sixth preset threshold value and the third preset difficulty label value can be flexibly set according to actual application scenarios.
[0188] In specific implementation, some texts in the first target text set can have great differences in syntax, words and word meanings from other texts. For example, when it is judged that some texts in the first target text set are classical Chinese, these texts should be removed.
[0189] In some embodiments of the present specification, before the splitting processing of each text in the target text set is performed to obtain the feature set corresponding to each text in the first training text set, the following processing can also be included:
[0190] The first target text set is filtered according to target text requirements.
[0191] After the above adjustment process, the difficulty grading evaluation model has high accuracy. A large amount of corpus with difficulty evaluation values can be obtained by using the difficulty grading evaluation model.
[0192] For step S13, some optional examples are given below.
[0193] As known from the foregoing, the number of texts in the obtained labeled first target text set is small. If the training text set is directly input into the preset pre-training model to train the pre-training model to obtain the difficulty classification model, the pre-training model is difficult to learn the relationship between text difficulty and its features (e.g., words, characters) due to the small training corpus. Therefore, a semi-supervised learning-like manner can be adopted, that is, the difficulty classification evaluation model is first constructed using the labeled first training text set, and then a large amount of unlabeled text is obtained, which is input into the difficulty classification evaluation model, so that a large amount of labeled text can be obtained.
[0194] Referring to Figure 4 The flowchart of a method for obtaining a second target text set with labeled information in an embodiment of the present specification can be executed according to the following steps:
[0195] S40, each text in the unlabeled second target text set is split to obtain a feature set corresponding to each text in the unlabeled second target text set.
[0196] Among them, the feature type in the feature set includes at least one of the following: word, character.
[0197] As known from the foregoing, the embodiment of the present specification uses the words and characters in the feature set corresponding to the text as the features for measuring the difficulty of the text. Therefore, before the unlabeled second target text set is input into the text difficulty classification evaluation model, the unlabeled second target text set can be subjected to word segmentation processing to obtain the feature set corresponding to each text.
[0198] S41, according to the lexicon library, the difficulty values of the characters and the difficulty values of the words of each text in the second target text set are obtained.
[0199] Among them, the determination process of the difficulty values of the characters and the difficulty values of the words of each text in the second target text set can refer to the acquisition process of the difficulty values of the characters and the words of each text in the first training text set, which will not be repeated here.
[0200] S42, the number of all characters and the number of all words in the feature set corresponding to each text in the unlabeled second target text set are counted respectively, and the difficulty average value of the characters and the difficulty average value of the words of each text in the second target text set are obtained according to the difficulty values of the characters and the difficulty values of the words of each text.
[0201] S43, input all the word numbers and the average difficulty of the words, and all the word numbers and the average difficulty of the words in the feature set corresponding to each text in the unlabeled second target text set into the difficulty grading evaluation model to obtain the difficulty evaluation value corresponding to each text in the unlabeled second target text set.
[0202] S44, according to the difficulty evaluation value corresponding to each text in the unlabeled second target text set, normalize the difficulty evaluation value corresponding to each text in the unlabeled second target text set to obtain the difficulty pseudo-label value corresponding to each text in the unlabeled second target text set.
[0203] Specifically, since the unlabeled second target text set includes multiple texts, the difficulty grading evaluation model can obtain the difficulty evaluation value corresponding to each text. At this time, the difficulty evaluation value can be normalized to obtain the difficulty true value corresponding to the difficulty evaluation value.
[0204] As a specific example, the difficulty value range of the labeled first target text set is P to Q, and the difficulty evaluation values corresponding to each text in the second target text set obtained by the difficulty grading evaluation model are A1, A2, …, A r , …, A m , where P, m, Q are integers greater than or equal to 0, r is an integer greater than 0 and less than or equal to m, Q is greater than P, and 0 < A1 < A2 < … < A r < … < A m , then the corresponding difficulty pseudo-label value B r :
[0205]
[0206] , where B r is used to represent the difficulty pseudo-label value corresponding to each text in the unlabeled second target text set; A r is used to represent the difficulty evaluation value corresponding to each text in the unlabeled second target text set; Q is used to represent the maximum text difficulty of the labeled first target text set, and P is used to represent the minimum text difficulty of the labeled first target text set.
[0207] It can be understood that if the difficulty true value obtained by normalizing the difficulty pseudo-label value corresponding to each text in the second training text set is a decimal number, the integer operation can be performed on it, for example, the rounding operation can be performed on the obtained difficulty true value to obtain the difficulty true value of the integer value.
[0208] It should be noted that when the difficulty evaluation value corresponding to each text in the second target text set is normalized to obtain a difficulty pseudo-label value greater than Q, the difficulty pseudo-label value of each text in the second target text set can be set to Q; when the obtained difficulty pseudo-label value is less than P, the difficulty pseudo-label value of each text in the second target text set can be set to P.
[0209] After the above difficulty grading evaluation model establishment process and the unannotated second target text set label annotation process, a large number of annotated second target text sets can be obtained, and the pre-trained model can be trained using the annotated second target text set.
[0210] For step S14, a specific implementation example is given below.
[0211] Referring to Figure 5 The flowchart of the training method of the text difficulty grading model in the embodiment of the specification, in some embodiments of the specification, the pre-set pre-training model includes: an encoding layer and a multi-layer perceptron network layer coupled with the encoding layer, and the training of the text difficulty grading model can be performed according to the following steps:
[0212] S50, inputting the annotated second target text set into the encoding layer, and converting the annotated second target text set into a corresponding feature vector by the encoding layer.
[0213] The feature vector is obtained in the following manner: inputting the word vector (word embedding) and position vector of the annotated second target text into the encoding layer, and obtaining the output corresponding to the first vector as the feature vector representation of the entire text, wherein the word vector represents a function mapping relationship, which is used to represent the numerical vector corresponding to the text feature, for example, the numerical vector corresponding to the text feature "Hello" can be (0.1, 0.5, 0.3, 0.2, 0.2); the position vector is used to represent the position of the word vector in the entire text; and the first vector represents the first vector in the entire text.
[0214] As a specific example, the encoding layer can be a Long-Decument Transformer (Longformer) model, using a word segmentation tool, the ID sequence and mask sequence corresponding to each text in the annotated second target text set can be obtained, the ID sequence and mask sequence corresponding to each text are input into the Longformer model, and the first vector, for example, the Classification (CLS) vector, is obtained from the output of the Longformer model, and the CLS vector is used as the feature vector identifier of the entire text.
[0215] S51, input the feature vector into the multi-layer perceptron network layer, and predict the labeled second target text according to the feature vector by the multi-layer perceptron network layer to obtain the difficulty prediction value of each text in the labeled second target text set.
[0216] S52, construct a loss function based on the difficulty prediction value and the difficulty pseudo-label value of each text in the second target text set, and update the parameters of the encoding layer and the multi-layer perceptron network layer according to the loss function to obtain an initial text difficulty classification model.
[0217] S53, select part of the labeled second target text set and input it into the initial text difficulty classification model together with the first training text set, and output the difficulty prediction value corresponding to each text in part of the labeled second target text set and the first training text set by the multi-layer perceptron network layer.
[0218] S54, construct a loss function based on the difficulty prediction value and the difficulty pseudo-label value of each text in part of the labeled second target text set, and the difficulty prediction value and the difficulty true value corresponding to each text in the first training text set, and update the parameters of the initial text difficulty classification model according to the loss function to obtain the text difficulty classification model.
[0219] Specifically, when the corresponding difficulty prediction value is obtained by inputting the training sample (including part of the labeled second target text set and the first training text set) each time, the loss function can be constructed according to the corresponding difficulty pseudo-label value, and the parameters of the initial text difficulty classification model are optimized according to the loss function to reduce the prediction loss of the initial text difficulty classification model.
[0220] Meanwhile, the update termination condition can be set to stop updating the parameters of the initial text difficulty classification model.
[0221] As a specific example, when the difficulty prediction value of the text output by the initial text difficulty classification model is close to the difficulty pseudo-label value, it can be considered that the accuracy of the difficulty prediction value output by the initial text difficulty classification model is high, and the updating of the parameters of the initial text difficulty classification model can be stopped.
[0222] In specific implementation, the difficulty values of part of the texts may not differ much, but the reading difficulty of the texts differs greatly. If the user selects the texts only according to the difficulty values of the texts, there may be a situation that the user cannot understand the content of the text or the text is not suitable for the user to read.
[0223] For example, if the user is a student, the corresponding text is the text of the first semester of the fifth grade, and according to the foregoing, the difficulty true value should be 11, and the difficulty value predicted by the above model may be 8 or 14, resulting in a mismatch between the text difficulty and the user's reading level.
[0224] Based on this, before the first training text set and the labeled second target text set are input into the preset pre-training model as a second training text set, the pre-training model is trained to obtain a text difficulty classification model, further comprising:
[0225] Establish the mapping relationship between the difficulty true value corresponding to each text in the first training text set, the difficulty true value corresponding to each text in the second target text set, and the segmented label value.
[0226] The first training text set and the labeled second target text set are input into the preset pre-training model as a second training text set, the pre-training model is trained to obtain a text difficulty classification model, comprising:
[0227] The labeled second target text set is input into the encoding layer, and the encoding layer converts the labeled second target text set into a corresponding feature vector.
[0228] Wherein, the feature vector is obtained in the following way: the word vector and the position vector of the labeled second target text are input into the encoding layer, and the output corresponding to the first vector is obtained as the feature vector representation of the entire document;
[0229] The feature vector is input into the multi-layer perceptron network layer, and the multi-layer perceptron network layer predicts the labeled second target text set according to the feature vector to obtain the difficulty prediction value of each text in the labeled second target text set, and obtains the segmented label prediction value corresponding to each text in the labeled second target text set based on the mapping relationship;
[0230] Based on the difficulty prediction value, the difficulty pseudo-label value, the segmented label value and the segmented label prediction value of each text in the second target text set, a loss function is constructed, and the parameters of the encoding layer and the multi-layer perceptron network layer are updated according to the loss function to obtain an initial text difficulty classification model;
[0231] part of the labeled second target text set and the first training text set to the initial text difficulty grading model, and outputs difficulty prediction values corresponding to each text in part of the labeled second target text set and each text in the first training text set by the multi-layer perceptron network layer, and respectively obtains segmented prediction values corresponding to each text in part of the labeled second target text set and each text in the first training text set according to the mapping relationship;
[0232] Based on the difficulty prediction values, segmented prediction values, and segmented label values corresponding to each text in part of the labeled second target text set and each text in the first training text set, and the difficulty label values corresponding to each text in the labeled second target text set and the difficulty true values corresponding to each text in the first training text set, a loss function is constructed, and the parameters of the initial text difficulty grading model are updated according to the loss function to obtain the text difficulty grading model.
[0233] By the above method, first, the labeled second target text set is input into the pre-set pre-training model to pre-train the pre-training model, which can enable the pre-training model to learn the corresponding relationship between the text difficulty value and its features from a wide range of labeled second target text sets. Then, part of the labeled second target text set is selected and input into the initial text difficulty grading model together with the first training text set to update the parameters of the initial text difficulty grading model, which can avoid overfitting problem caused by too little training data, thereby improving the grading accuracy of the obtained text difficulty grading model.
[0234] After the above training process, the text difficulty grading model can be obtained, and the text difficulty grading model can be used to predict the difficulty value corresponding to the text.
[0235] Referring to Figure 6 the flowchart of a text difficulty grading method in an embodiment of the present specification, in some embodiments of the present specification, the following steps can be performed:
[0236] S60, obtaining a text to be graded.
[0237] In specific implementation, the text to be graded can be obtained by manual input or automatically obtained in response to a received processing instruction.
[0238] S61, inputting the text to be graded into a text difficulty grading model for processing to obtain a difficulty value of the text to be graded and outputting the difficulty value.
[0239] The text difficulty grading model is obtained by inputting a first training text set, a labeled second target text set as a second training text set into a preset pre-training model, and training the pre-training model, wherein the first training text set comprises label data of a difficulty real value corresponding to each text; the difficulty pseudo label value of the labeled second target text set is obtained according to an established difficulty grading evaluation model; and the difficulty grading evaluation model is obtained according to a feature set corresponding to each text in the first training text set and a preset weight coefficient.
[0240] In some embodiments of the present specification, the text difficulty grading model comprises an encoding layer and a multi-layer perceptron network layer.
[0241] The inputting the text to be graded into the text difficulty grading model to obtain and output the difficulty value of the text to be graded comprises:
[0242] The text to be graded is input into the encoding layer, and the text to be graded is converted into a corresponding feature vector by the encoding layer, wherein the feature vector is obtained in the following manner: the word vector and the position vector of the text to be graded are input into the encoding layer, and the output corresponding to the first vector is obtained as the feature vector representation of the entire text.
[0243] The feature vector is input into the multi-layer perceptron network layer, and the difficulty value of the text to be graded is predicted and output by the multi-layer perceptron network layer based on the feature vector of the text to be graded.
[0244] By using the text difficulty grading method in the present specification, since the text difficulty grading model is a model obtained by updating a preset pre-training model based on the difficulty prediction value of the text set output by the pre-training model and the difficulty real value corresponding thereto, compared with existing models, the text grading model can better learn the relationship between the difficulty of the text set and its features, and therefore, when the text difficulty grading model is used to grade and predict the obtained text to be graded, the accuracy of the output difficulty grading value can be improved.
[0245] The present specification also provides a device corresponding to the above-mentioned text difficulty grading scheme, which will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0246] Referring to Figure 7 The structure of the text difficulty grading training device 70 in the present specification is shown in the structural schematic diagram of the text difficulty grading training device in the present specification. In some embodiments of the present specification, the text difficulty grading training device 70 can comprise:
[0247] The first target text set acquisition module 71 is suitable for acquiring an annotated first target text set, and the first target text set includes label data corresponding to a difficulty true value of each text, wherein the first target text set includes a first training text set;
[0248] The preprocessing module 72 is suitable for preprocessing each text in the first target text set to obtain a feature set corresponding to each text in the first training text set;
[0249] The difficulty grading evaluation model construction module 73 is suitable for establishing a difficulty grading evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient;
[0250] The second target text set acquisition module 74 is suitable for acquiring an unannotated second target text set;
[0251] The difficulty label value calculation module 75 is suitable for calculating a difficulty pseudo label value corresponding to each text in the unannotated second target text set according to the difficulty grading evaluation model to obtain an annotated second target text set;
[0252] The training module 76 is suitable for inputting the first training text set and the annotated second target text set as a second training text set into a pre-set pre-training model, training the pre-training model, and obtaining a text difficulty grading model.
[0253] By using the above scheme, the unannotated second target text set is processed by establishing a difficulty grading evaluation model, an annotated second target text set with a difficulty pseudo label value is obtained, the training corpus of the pre-set pre-training model is increased, and compared with an existing model, a text difficulty grading model with higher difficulty grading precision can be obtained by using more training corpus with a difficulty label value, so that the accuracy of text difficulty grading is improved when the text difficulty grading model is used to grade the text difficulty, and it is convenient for a user to select a suitable reading text.
[0254] The specific implementation of each module of the above text difficulty grading training device can be referred to the corresponding specific introduction in the foregoing embodiments, which will not be described here.
[0255] Referring to Figure 8 The text difficulty grading training 80 can include the following modules in some embodiments of the present specification:
[0256] The text acquisition module 81 is suitable for acquiring a text to be graded;
[0257] The processing module 82 is suitable for inputting the text to be graded into a text difficulty grading model to obtain a difficulty value of the text to be graded and output the difficulty value.
[0258] The text difficulty grading model is obtained by inputting the first training text set, the labeled second target text set as a second training text set into a preset pre-training model, and training the pre-training model, wherein the first training text set includes label data corresponding to the difficulty true value of each text; the difficulty pseudo-label value of the labeled second target text set is obtained according to an established difficulty grading evaluation model; and the difficulty grading evaluation model is obtained according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient.
[0259] The embodiments of the present specification also provide an electronic device for predicting text difficulty, such as Figure 9 As shown in FIG. 9, the electronic device 90 can include a memory 91 and a processor 92, wherein the memory 91 is adapted to store one or more computer instructions, and the processor 92 executes the computer instructions to perform the steps of the training method according to any one of the preceding embodiments, or the steps of the grading method according to any one of the preceding embodiments.
[0260] In specific implementation, as shown in FIG. 9, the electronic device 90 can further include an expansion interface 93 adapted to be connected with other devices to realize data interaction. Figure 9
[0261] The electronic device 90 can be a general-purpose or special-purpose computer device, and more specifically, can be a server or a computer terminal, for example, a personal computer device, a portable terminal device, etc.
[0262] In specific implementation, the memory 91, the processor 92 and the expansion interface 93 can be connected through a bus.
[0263] In specific implementation, the processor can be implemented by a central processing unit (CPU), a graphics processing unit (GPU), a field programmable gate array (FPGA), etc. processing chip, or can be implemented by an application specific integrated circuit (ASIC) or one or more integrated circuits configured to implement the embodiments of the present specification.
[0264] The memory can include a Random Access Memory (RAM) memory, and can also include a Non-Volatile Memory (NVM), such as at least one disk memory.
[0265] The embodiments of the present application also provide a computer readable storage medium having computer instructions stored thereon, wherein the computer instructions, when executed, can perform the steps of the training method according to any one of the preceding embodiments, or the steps of the grading method according to any one of the preceding embodiments. The computer readable storage medium can be an optical disc, a mechanical hard disk, a solid state disk, or any other suitable readable storage medium. The computer instructions stored on the computer readable storage medium perform the steps of the training method according to any one of the preceding embodiments, or the steps of the grading method according to any one of the preceding embodiments, which will not be described herein.
[0266] The computer readable storage medium can include, for example, any suitable type of memory unit, memory device, memory article, memory medium, storage device, storage article, storage medium and / or storage unit for example, memory, removable and / or non-removable media, erasable and / or non-erasable media, writeable and / or re-writeable media, digital and / or analog media, hard disk, floppy disk, Compact Disc Read Only Memory (CD-ROM), Compact Disc Recordable' (CD-R), Compact Disc Rewriteable (CD-RW), optical disk, magnetic media, magneto-optical media, removable memory cards or disks, various types of Digital Versatile Disc (DVD), a tape, a cassette, or the like.
[0267] The computer instructions can include any suitable type of codes, such as source codes, compiled codes, interpreted codes, executable codes, static codes, dynamic codes, encrypted codes, and the like, implemented by using any suitable high-level, low-level, object-oriented, visualized, compiled and / or interpreted programming languages.
[0268] It should be understood that the terms "first", "second", and the like, are used only for descriptive purposes, and cannot be construed as indicating or implying relative importance or an implied indication of the number of indicated technical features. Thus, features defined with "first", "second", and the like, can explicitly or implicitly include one or more of the features. Moreover, the terms "first", "second", and the like, are used to distinguish similar objects, and do not necessarily describe a specific order or indicate importance. It can be understood that the terms used in this way can be interchanged as appropriate, so that the embodiments of the present specification described herein can be implemented in an order other than those illustrated or described herein.
[0269] Although the embodiments of the present specification are disclosed as above, the embodiments of the present specification are not limited thereto. Any person skilled in the art, without departing from the spirit and scope of the embodiments of the present specification, can make various changes and modifications, therefore the scope of protection of the embodiments of the present specification should be subject to the scope defined by the claims.
Claims
1. A method of training for text difficulty grading, characterized by, The method comprises the following steps: obtaining a first target text set with labels, wherein the first target text set comprises label data corresponding to the difficulty of each text, and the first target text set comprises a first training text set; preprocessing each text in the first target text set to obtain a feature set corresponding to each text in the first training text set; establishing a difficulty classification evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient, wherein the establishment of the difficulty classification evaluation model comprises the following steps: obtaining a reference text set; extracting features of the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to each feature in the lexicon library; searching for each feature in the feature set corresponding to each text in the first training text set in the lexicon library, and establishing the difficulty classification evaluation model according to the pre-set weight coefficient; wherein the extraction of the features of the reference text set, the construction of the lexicon library, and the calculation of the difficulty values corresponding to each feature in the lexicon library comprise the following steps: extracting features of each text in the reference text set, counting the frequency of each feature according to the feature type, and sorting according to the frequency of each feature to obtain the lexicon library, wherein the lexicon library comprises a dictionary library and a word dictionary library; determining the difficulty values corresponding to each character in the dictionary library and the difficulty values corresponding to each feature in the word dictionary library according to the sorting results of the corresponding feature types of the dictionary library and the word dictionary library, respectively; obtaining a second target text set without labels, and calculating the difficulty pseudo-label values corresponding to each text in the second target text set without labels according to the difficulty classification evaluation model to obtain a second target text set with labels; inputting the first training text set and the second target text set with labels into a pre-set pre-training model as a second training text set, training the pre-training model, and obtaining a text difficulty classification model.
2. The training method of claim 1, wherein, The extraction of the features of the reference text set, the construction of the lexicon library, and the calculation of the difficulty values corresponding to each feature in the lexicon library further comprise: normalizing the difficulty values corresponding to each character in the dictionary library and the difficulty values corresponding to each feature in the word dictionary library, respectively.
3. The training method of claim 2, wherein, The preprocessing of each text in the first target text set to obtain a feature set corresponding to each text in the first training text set comprises: splitting each text in the first target text set to obtain a feature set corresponding to each text in the first training text set, and the feature types in the feature set comprise at least one of the following: character, word.
4. The training method of claim 3, wherein, The searching for each feature in the feature set corresponding to each text in the first training text set in the lexicon library and the establishment of the difficulty classification evaluation model according to the pre-set weight coefficient comprise: In the dictionary library, the characters in the feature set corresponding to each text in the first training text set are searched, and when the same character is searched, the difficulty value of the corresponding character in the dictionary library is taken as the difficulty value of the character in the feature set corresponding to each text in the first training text set; and when the same character is not searched, the difficulty value of the character in the feature set corresponding to each text in the first training text set is set to 1; In the dictionary library, the words in the feature set corresponding to each text in the first training text set are searched, and when the same word is searched, the difficulty value of the corresponding word in the dictionary library is taken as the difficulty value of the word in the feature set corresponding to each text in the first training text set; and when the same word is not searched, the difficulty value of the character in the feature set corresponding to each text in the first training text set is set to 1; The number of characters and the number of words in the feature set corresponding to each text in the first training text set are counted respectively, and the difficulty average values of the characters and the words in the feature set corresponding to each text in the first training text set are calculated according to the counted number of characters and the number of words in the feature set corresponding to each text in the first training text set, and the difficulty values corresponding to each character and each word, and the difficulty classification evaluation model is established according to the pre-set weight coefficient, and the difficulty classification evaluation model is adjusted, wherein the difficulty classification evaluation model is: ; wherein, L a difficulty assessment value for characterizing the text; W av a difficulty average value for characterizing all words in a feature set corresponding to the text; W n a number of all words for characterizing a feature set corresponding to the text; V av a difficulty average value for characterizing all words in a feature set corresponding to the text; V n a number of all words for characterizing a feature set corresponding to the text; α a weight coefficient for characterizing a word, β a weight coefficient for characterizing a word.
5. The training method of claim 4, wherein, The adjustment of the difficulty classification evaluation model includes: All the number of characters and the number of words in the feature set corresponding to each text in the first training text set, and the average value of the characters and the average value of the words are brought into the difficulty classification evaluation model to obtain the difficulty pseudo-label value corresponding to each text in the first training text set, and the difficulty label value corresponding to each text is normalized to the difficulty true value corresponding to each text as the difficulty evaluation value; The difficulty average values of the first m characters with the maximum difficulty value in each text in the first training text set are calculated respectively as the difficulty average values of the first m characters in each text, and the difficulty average values of the first n words with the maximum difficulty value in each text are calculated as the difficulty average values of the first n words in each text; When the difficulty average values of the first m characters in each text are greater than or equal to a first preset threshold value, the difficulty average values of the first n words in each text are greater than or equal to a second preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a first preset difficulty prediction range value, the difficulty label value calculated by the difficulty classification evaluation model is added by a first preset difficulty label value; Wherein, m and n are both integers greater than 1.
6. The training method of claim 5, wherein, The feature type in the feature set corresponding to each text in the first training text set also includes a sentence; The adjustment of the difficulty classification evaluation model also includes: The number of sentences and the average length of sentences in the first training text set are calculated; When the average length of sentences is greater than or equal to a third preset threshold value, the number of sentences is greater than or equal to a fourth preset threshold value, and the difficulty evaluation value of each text in the first training text set is less than a second preset difficulty label value, the difficulty label value calculated by the difficulty classification evaluation model is set to a second preset difficulty label value; When the average length of the sentences is less than or equal to the fifth preset threshold, the number of the sentences is less than or equal to the sixth preset threshold, and the difficulty evaluation value of each text in the first training text set is greater than the third preset difficulty label value, the difficulty label value calculated by the difficulty grading evaluation model is set as the third preset difficulty label value.
7. Training method according to any one of claims 3 to 6, characterized in that, Before the splitting processing of each text in the first target text set to obtain the feature set corresponding to each text in the first training text set, the method further includes: Filtering processing of the first target text set according to target text requirements.
8. The training method of claim 5, wherein, The obtaining of the unlabeled second target text set and the calculation of the difficulty pseudo-label value corresponding to each text in the unlabeled second target text set according to the difficulty grading evaluation model to obtain the labeled second target text set includes: Splitting processing of each text in the unlabeled second target text set to obtain a feature set corresponding to each text in the unlabeled second target text set, wherein the feature types in the feature set include at least one of the following: word, term; Obtaining of the difficulty values of words and the difficulty values of terms of each text in the second target text set according to the lexicon library; Statistically counting all the word numbers and term numbers in the feature set corresponding to each text in the unlabeled second target text set, and obtaining the difficulty average values of words and the difficulty average values of terms of each text in the second target text set according to the difficulty values of words and the difficulty values of terms of each text; Bringing all the word numbers and the difficulty average values of words and all the term numbers and the difficulty average values of terms in the feature set corresponding to each text in the unlabeled second target text set into the difficulty grading evaluation model to obtain the difficulty evaluation value corresponding to each text in the unlabeled second target text set; According to the difficulty evaluation value corresponding to each text in the unlabeled second target text set, the difficulty evaluation value corresponding to each text in the unlabeled second target text set is normalized to obtain the difficulty pseudo-label value corresponding to each text in the unlabeled second target text set.
9. The training method of claim 1, wherein, The preset pre-training model includes an encoding layer and a multi-layer perceptron network layer coupled with the encoding layer.
10. The training method of claim 9, wherein, The inputting of the first training text set and the labeled second target text set as a second training text set into a preset pre-training model, the training of the pre-training model to obtain a text difficulty grading model includes: Inputting the labeled second target text set into the encoding layer to convert the labeled second target text set into a corresponding feature vector by the encoding layer, wherein the feature vector is obtained in the following manner: the word vector and the position vector of the labeled second target text are input into the encoding layer, and the output corresponding to the first vector is obtained as the feature vector representation of the entire text; Inputting the feature vector into the multi-layer perceptron network layer to predict the labeled second target text set according to the feature vector by the multi-layer perceptron network layer to obtain the difficulty prediction value of each text in the labeled second target text set; constructing a loss function based on the difficulty prediction values and the difficulty pseudo-label values of the texts in the second target text set, and updating parameters of the encoding layer and the multi-layer perceptron network layer according to the loss function to obtain an initial text difficulty classification model; selecting part of the labeled second text set and inputting the part of the labeled second text set and the first training text set into the initial text difficulty classification model, and outputting, by the multi-layer perceptron network layer, the difficulty prediction values corresponding to the texts in the part of the labeled second target text set and the texts in the first training text set; constructing a loss function based on the difficulty prediction values and the difficulty pseudo-label values of the texts in the part of the labeled second target text set, and the difficulty prediction values and the difficulty true values corresponding to the texts in the first training text set, and updating parameters of the initial text difficulty classification model according to the loss function to obtain the text difficulty classification model.
11. The training method of claim 9, wherein, Before the first training text set and the labeled second target text set are input into a preset pre-training model as a second training text set to train the pre-training model and obtain the text difficulty classification model, the method further includes: establishing a mapping relationship between the difficulty true values corresponding to the texts in the first training text set, the difficulty true values corresponding to the texts in the second target text set, and the segmentation label values; the method of inputting the first training text set and the labeled second target text set into a preset pre-training model as a second training text set to train the pre-training model and obtain the text difficulty classification model includes: inputting the labeled second target text set into the encoding layer, and converting, by the encoding layer, the labeled second target text set into a corresponding feature vector, wherein the feature vector is obtained in the following manner: inputting a word vector and a position vector of the labeled second target text into the encoding layer, and obtaining an output corresponding to a first vector as a feature vector representation of the entire text; inputting the feature vector into the multi-layer perceptron network layer, and predicting, by the multi-layer perceptron network layer, the labeled second target text set according to the feature vector to obtain difficulty prediction values of the texts in the labeled second target text set, and obtaining segmentation label prediction values corresponding to the texts in the labeled second target text set based on the mapping relationship; constructing a loss function based on the difficulty prediction values, the difficulty pseudo-label values, the segmentation label values, and the segmentation label prediction values of the texts in the second target text set, and updating parameters of the encoding layer and the multi-layer perceptron network layer according to the loss function to obtain an initial text difficulty classification model; selecting part of the labeled second target text set and inputting the part of the labeled second target text set and the first training text set into the initial text difficulty grading model, outputting, by the multi-layer perceptron network layer, a difficulty prediction value corresponding to each text in the part of the labeled second target text set and each text in the first training text set, and obtaining, according to the mapping relationship, a segmentation prediction value corresponding to each text in the part of the labeled second target text set and each text in the first training text set, respectively; based on the difficulty prediction value, the segmentation prediction value, and the segmentation label value corresponding to each text in the part of the labeled second target text set and each text in the first training text set, and the difficulty label value corresponding to each text in the labeled second target text set and the difficulty true value corresponding to each text in the first training text set, constructing a loss function, and updating parameters of the initial text difficulty grading model according to the loss function to obtain the text difficulty grading model.
12. A method of text difficulty grading, characterized by, comprises: obtaining a text to be graded; inputting the text to be graded into a text difficulty grading model to obtain a difficulty value of the text to be graded and outputting the difficulty value; wherein the text difficulty grading model is obtained by inputting a first training text set and a labeled second target text set into a pre-trained model as a second training text set, and training the pre-trained model, wherein the first training text set comprises label data of a difficulty true value corresponding to each text; the difficulty pseudo label value of the labeled second target text set is obtained according to a difficulty grading evaluation model; the difficulty grading evaluation model is obtained according to a feature set corresponding to each text in the first training text set and a pre-set weight coefficient; wherein the difficulty grading evaluation model is obtained according to the feature set corresponding to each text in the first training text set and the pre-set weight coefficient, comprising: obtaining a reference text set; extracting features of the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to each feature in the lexicon library; searching for each feature in the feature set corresponding to each text in the first training text set in the lexicon library, and establishing the difficulty grading evaluation model according to the pre-set weight coefficient; wherein the extracting features of the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to each feature in the lexicon library comprise: extracting features of each text in the reference text set, counting frequencies of each feature according to feature types, and sorting the frequencies to obtain the lexicon library, wherein the lexicon library comprises a dictionary library and a word dictionary library; determining difficulty values corresponding to each character in the dictionary library and difficulty values corresponding to each feature in the word dictionary library according to sorting results of corresponding feature types of the dictionary library and the word dictionary library, respectively.
13. The method of claim 12, wherein, The text difficulty grading model comprises an encoding layer and a multi-layer perceptron network layer; the inputting the text to be graded into a text difficulty grading model to obtain a difficulty value of the text to be graded and outputting the difficulty value comprises: inputting the text to be classified into the encoding layer, and converting the text to be classified into a corresponding feature vector by the encoding layer, wherein the feature vector is obtained by inputting a word vector and a position vector of the text to be classified into the encoding layer, and obtaining an output corresponding to the first position vector as a feature vector representation of the entire text; inputting the feature vector into the multi-layer perceptron network layer, and predicting a difficulty value of the text to be classified based on the feature vector of the text to be classified by the multi-layer perceptron network layer and outputting the difficulty value.
14. A text difficulty grading training apparatus, characterized by, The method comprises: a first target text set obtaining module adapted to obtain a first target text set with labels, wherein the first target text set comprises a difficulty true value corresponding to each text, and the first target text set comprises a first training text set; a preprocessing module adapted to preprocess each text in the first target text set to obtain a feature set corresponding to each text in the first training text set; a difficulty classification evaluation model construction module adapted to construct a difficulty classification evaluation model according to the feature set corresponding to each text in the first training text set and a pre-set weight coefficient, wherein the construction of the difficulty classification evaluation model comprises: obtaining a reference text set; extracting features of the reference text set, constructing a lexicon library, and calculating difficulty values corresponding to each feature in the lexicon library; searching each feature in the feature set corresponding to each text in the first training text set in the lexicon library, and establishing the difficulty classification evaluation model according to the pre-set weight coefficient; wherein the extraction of the features of the reference text set, the construction of the lexicon library, and the calculation of the difficulty values corresponding to each feature in the lexicon library comprise: extracting features of each text in the reference text set, counting the frequency of occurrence of each feature according to the feature type, and sorting according to the frequency of occurrence of each feature to obtain the lexicon library, wherein the lexicon library comprises a dictionary library and a word dictionary library; determining the difficulty values corresponding to each word in the dictionary library and the difficulty values corresponding to each feature in the word dictionary library according to the sorting results of the corresponding feature types of the dictionary library and the word dictionary library, respectively; a second target text set obtaining module adapted to obtain a second target text set without labels; a difficulty label value calculation module adapted to calculate a difficulty pseudo label value corresponding to each text in the second target text set without labels to obtain a second target text set with labels; a training module adapted to input the first training text set and the second target text set with labels as a second training text set into a pre-set pre-training model, train the pre-training model, and obtain a text difficulty classification model.
15. A text difficulty grading apparatus characterized by comprising: The method comprises: a text obtaining module adapted to obtain a text to be classified; a processing module adapted to input the text to be classified into a text difficulty classification model, obtain a difficulty value of the text to be classified, and output the difficulty value. The text difficulty grading model is obtained by inputting a first training text set, a labeled second target text set as a second training text set into a preset pre-training model, and training the pre-training model, wherein the first training text set includes label data corresponding to a difficulty true value of each text; a difficulty pseudo-label value of the labeled second target text set is obtained according to an established difficulty grading evaluation model; the difficulty grading evaluation model is obtained according to a feature set corresponding to each text in the first training text set and a preset weight coefficient; wherein the difficulty grading evaluation model is established according to the feature set corresponding to each text in the first training text set and the preset weight coefficient, including: obtaining a reference text set; extracting features of the reference text set, constructing a glossary library, and calculating difficulty values corresponding to each feature in the glossary library; searching each feature in the feature set corresponding to each text in the first training text set in the glossary library, and establishing the difficulty grading evaluation model according to the preset weight coefficient; wherein the extracting features of the reference text set, constructing a glossary library, and calculating difficulty values corresponding to each feature in the glossary library include: extracting features of each text in the reference text set, counting the frequency of occurrence of each feature according to the feature type, and sorting according to the frequency of occurrence of each feature to obtain the glossary library, wherein the glossary library includes a dictionary library and a word dictionary library; respectively determining difficulty values corresponding to each character in the dictionary library and difficulty values corresponding to each feature in the word dictionary library according to the sorting results of the corresponding feature types of the dictionary library and the word dictionary library.
16. An electronic device comprising a memory and a processor, wherein, The memory is adapted to store one or more computer instructions, characterized in that when the processor runs the computer instructions, the steps of the training method of any one of claims 1 to 11 are executed, or the steps of the grading method of claim 12 or 13 are executed.
17. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions run to execute the steps of the training method of any one of claims 1 to 11, or the steps of the grading method of claim 12 or 13.
Citation Information
Patent Citations
Method for grading Chinese texts and calculating difficulty scores of Chinese texts
CN107977362A
Model training method and device, text classification method and device and network model
CN111966831A