CN112507663A - Text-based judgment question generation method and device, electronic equipment and storage medium - Google Patents

Text-based judgment question generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112507663A
CN112507663A CN202011486652.2A CN202011486652A CN112507663A CN 112507663 A CN112507663 A CN 112507663A CN 202011486652 A CN202011486652 A CN 202011486652A CN 112507663 A CN112507663 A CN 112507663A
Authority
CN
China
Prior art keywords
word
speech
text
feature
word segmentation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011486652.2A
Other languages
Chinese (zh)
Inventor
陈杭
赖众程
倪佳
张舒婷
林志超
史文鑫
何凤连
李骁
李筱艺
李会璟
赖幸斌
林嘉喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011486652.2A priority Critical patent/CN112507663A/en
Publication of CN112507663A publication Critical patent/CN112507663A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/117Tagging; Marking up; Designating a block; Setting of attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Machine Translation (AREA)

Abstract

The invention relates to an artificial intelligence technology, and discloses a judgment question generation method based on a text, which comprises the following steps: the method comprises the steps of constructing and training a part-of-speech tagging and word segmentation model comprising a feature conversion layer, a part-of-speech tagging layer and a word segmentation layer, converting an original text set into a text feature set by using the feature conversion layer, performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set, performing word segmentation operation on the part-of-speech feature set by using the word segmentation layer to obtain a word feature set, performing weight division on the word feature set to obtain a word weight set, performing partial masking operation on the word weight set to obtain a masked word set, inputting the masked word set to a pre-constructed judgment question generation model, and generating a judgment question set. The invention also provides a device for generating the judgment questions based on the text, electronic equipment and a computer readable storage medium. The invention can solve the problems of poor readability and low accuracy of the generated judgment questions.

Description

Text-based judgment question generation method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a text-based judgment question generation method and device, electronic equipment and a computer-readable storage medium.
Background
The current method for automatically generating judgment questions based on texts mainly comprises the following steps: the method comprises the steps of firstly analyzing a syntax structure of a text to obtain the syntax structure, then splitting a sentence according to the syntax structure to obtain split words, and generating a judgment question through replacement operation and splicing operation of the split words.
Although the method can realize the automatic generation of the judgment questions, the generated judgment questions are hard and have poor readability through the replacement operation and the re-splicing of the split words, and secondly, the analysis accuracy is not high because the syntax structure analysis generally uses algorithms such as a currently disclosed greedy decision making action assembly syntax tree, a PCFG and a Lexical PCFG, and the quality of the generated judgment questions is greatly influenced.
Disclosure of Invention
The invention provides a method and a device for generating a judgment question based on a text, an electronic device and a computer readable storage medium, and mainly aims to solve the problems of poor readability and low accuracy of the generated judgment question.
In order to achieve the above object, the method for generating a judgment question based on a text provided by the present invention comprises:
constructing and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
receiving an original text set, and converting the original text set into a text feature set by using the feature conversion layer;
performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set;
calculating a word segmentation probability set of the part of speech characteristic set by using the word segmentation layer, and executing word segmentation operation on the part of speech characteristic set according to the word segmentation probability set to obtain a word characteristic set;
performing weight division on the word characteristic set to obtain a word weight set;
performing partial shielding operation on the word weight set to obtain a shielding word set;
and inputting the shielding word set into a pre-constructed judgment question generation model to generate a judgment question set.
Optionally, the constructing and training part-of-speech tagging and word segmentation model includes:
receiving a training text set and a part-of-speech tag set corresponding to the training text set, and performing replacement and shielding operations on the training text set to obtain a semi-shielded text set;
constructing a part-of-speech tagging and word segmentation model, and calculating a part-of-speech prediction set of the semi-occlusion text set by using the part-of-speech tagging and word segmentation model;
and calculating a difference value between the part of speech prediction set and the part of speech tag set, and when the difference value is greater than or equal to a preset threshold value, adjusting internal parameters of the part of speech tagging and word segmentation model until the difference value is less than the preset threshold value to obtain the trained part of speech tagging and word segmentation model.
Optionally, the calculating a part-of-speech prediction set of the semi-occluded text set by using the part-of-speech tagging and word segmentation model includes:
converting the semi-occlusion text set into a semi-occlusion vector set by utilizing the characteristic conversion layer;
and performing part-of-speech prediction on the semi-occlusion vector set by utilizing the part-of-speech tagging layer to obtain the part-of-speech prediction set.
Optionally, the calculating, by using the word segmentation layer, a word segmentation probability set of the part of speech feature set includes:
converting the part of speech characteristic set into a part of speech vector set with fixed dimensions;
and calculating the word segmentation probability of each part of speech vector in the part of speech vector set, and summarizing the word segmentation probability of each part of speech vector to obtain the word segmentation probability set.
Optionally, the performing weight division on the word feature set to obtain a word weight set includes:
according to the part of speech of the word feature set, dividing the word feature set into an adjective feature set, a verb feature set and a noun feature set;
and according to the weight proportion of the adjectives, the verbs and the nouns which are constructed in advance, carrying out weight division on the adjective feature set, the verb feature set and the noun feature set to obtain the word weight set.
Optionally, the performing a partial masking operation on the word weight set to obtain a masked word set includes:
extracting a specified number of words from the word weight set according to the weight of each part of speech in the word weight set to obtain a word combination set;
and executing a masking operation and a replacing operation on the word combination set according to a preset proportion to obtain the masked word set.
Optionally, the inputting the masking term set into a pre-constructed judgment question generation model to generate a judgment question set includes:
carrying out feature extraction on the shielding word set to obtain a shielding feature set;
converting the set of occlusion features into a set of occlusion vectors;
performing calculation according to the shielding vector set by utilizing a softmax function to obtain a word prediction probability set of shielding words in the shielding word set;
and replacing the original text set by using the word prediction probability set to generate the judgment question set.
In order to solve the above problem, the present invention also provides a text-based question generation apparatus, including:
the system comprises a part-of-speech tagging and word segmentation model building module, a word tagging and word segmentation model building module and a word segmentation model training module, wherein the part-of-speech tagging and word segmentation model building module is used for building and training a part-of-speech tagging and word segmentation model, and comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
the word feature calculation module is used for receiving an original text set, converting the original text set into a text feature set by using the feature conversion layer, performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set, calculating a word segmentation probability set of the part-of-speech feature set by using the word segmentation layer, and performing word segmentation operation on the part-of-speech feature set according to the word segmentation probability set to obtain a word feature set;
the masking word generating module is used for performing weight division on the word feature set to obtain a word weight set, and performing partial masking operation on the word weight set to obtain a masking word set;
and the judgment question generation module is used for inputting the shielding word set to a pre-constructed judgment question generation model to generate a judgment question set.
In order to solve the above problem, the present invention also provides an electronic device, including:
a memory storing at least one instruction; and
a processor executing instructions stored in the memory to implement the text-based question generation method of any one of the above.
In order to solve the above problem, the present invention further provides a computer-readable storage medium including a storage data area and a storage program area, the storage data area storing created data, the storage program area storing a computer program; wherein the computer program, when executed by a processor, implements the text-based question generation method of any one of the above.
In the embodiment of the invention, a part-of-speech tagging and word segmentation model is firstly constructed and trained, and a feature conversion layer and a part-of-speech tagging layer in the part-of-speech tagging and word segmentation model are utilized to perform feature conversion and part-of-speech tagging on an original text set Low accuracy.
Drawings
Fig. 1 is a schematic flow chart of a method for generating a judgment question based on a text according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart of the step S1 in the method for generating a judgment question based on text according to FIG. 1;
FIG. 3 is a detailed flowchart of step S5 in the method for generating a text-based question according to the present invention, shown in FIG. 1;
fig. 4 is a schematic block diagram of a device for generating a judgment question based on a text according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an internal structure of an electronic device implementing a method for generating a text-based question according to an embodiment of the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a judgment question generation method based on a text. The execution subject of the text-based judgment topic generation method includes, but is not limited to, at least one of electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the text-based judgment topic generation method may be executed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Fig. 1 is a schematic flow chart of a method for generating a judgment question based on a text according to an embodiment of the present invention. In this embodiment, the method for generating a judgment question based on a text includes:
s1, constructing and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer.
In the embodiment of the invention, the part-of-speech tagging and word segmentation model can realize the functions of performing word segmentation and part-of-speech tagging on the text and mainly comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer. The feature transformation layer comprises a BERT (Bidirectional Encoder retrieval from transforms), the part of speech tagging layer comprises a CRF (Conditional Random Field) model, and the word segmentation layer comprises a full connection layer and a probability calculation layer.
Further, referring to fig. 2, the constructing and training the part-of-speech tagging and word segmentation model includes:
s11, receiving a training text set and a part-of-speech label set corresponding to the training text set, and performing random replacement and masking operation on the training text set to obtain a semi-masked text set;
s12, constructing a part-of-speech tagging and word segmentation model, and calculating a part-of-speech prediction set of the semi-occlusion text set by using the part-of-speech tagging and word segmentation model;
s13, calculating the difference value between the part of speech prediction set and the part of speech tag set;
s14, judging whether the difference value is larger than a preset threshold value or not;
and when the difference value is greater than or equal to a preset threshold value, executing S15, adjusting internal parameters of the part-of-speech tagging and word segmentation model, returning to S12 until the difference value is less than the preset threshold value, and executing S16 to obtain the trained part-of-speech tagging and word segmentation model.
In the embodiment of the invention, the training text set is text data obtained by crawling from a network in advance and manually cleaning by means of crawlers and the like, and the training functions of the part-of-speech tagging and word segmentation models can be realized. The part-of-speech tag set records part-of-speech tags of each word in the training text set, and if the training text set comprises a training text A: the user waits for calling, and meanwhile, counter personnel log in a bank system to register an account, wherein parts of speech of each word of the training text A are recorded in the part of speech tag set as follows: "user (noun) waits (verb) to call number (verb) … …".
In the preferred embodiment of the present invention, 70% of the words in the training text set are masked with preset symbols (masked tokens), 10% of the words in the training text set are randomly replaced, and 20% of the remaining words in the training text set are kept unchanged to obtain the semi-masked text set.
Further, the replacement words of the random replacement operation are generally randomly acquired from a replacement word set constructed by the user in advance.
As the training text a: the user waits for calling, and meanwhile counter personnel log in a bank system to register an account, select the counter personnel, and if the counter personnel are shielded, the training text A is changed into: "the user waits for calling number, and simultaneously [ mask ] logs in the bank system to carry out account opening registration"; if the training text A is replaced by the counter personnel or the examination and approval personnel, the transformed training text A is obtained as follows: the method comprises the steps of 'waiting for number calling by a user and logging in a bank system for opening an account to register' or 'waiting for number calling by a user and logging in a bank system for opening an account to register' by an approver.
Further, the calculating a part-of-speech prediction set of the semi-occluded text set by using the part-of-speech tagging and word segmentation model includes:
converting the semi-occlusion text set into a semi-occlusion vector set by utilizing the characteristic conversion layer;
and performing part-of-speech prediction on the semi-occlusion vector set by utilizing the part-of-speech tagging layer to obtain the part-of-speech prediction set.
In a preferred embodiment of the present invention, the feature transformation layer comprises a BERT model, wherein the BERT model uses 12 layers of bi-directional codes (encor-decoders) as the feature transformation layer to transform the set of semi-masked texts into a set of semi-masked vectors. Wherein the bi-directional encoding may be a published feature extraction neural network.
Furthermore, the method and the device utilize a CRF model as a part-of-speech tagging layer to complete part-of-speech prediction, and obtain the part-of-speech prediction set. The CRF model achieves the purpose of word prediction by calculating the part-of-speech probability values of different parts-of-speech corresponding to each word and selecting the part-of-speech corresponding to the maximum part-of-speech probability value.
According to the embodiment of the invention, a difference value between the part of speech prediction set and the part of speech tag set can be calculated by using an Euclidean distance calculation method and a Chebyshev calculation method, and when the difference value is smaller than the preset threshold value, the part of speech tagging and word segmentation model which is trained is obtained.
S2, receiving an original text set, and converting the original text set into a text feature set by using the feature conversion layer.
In the embodiment of the invention, the original text set is a question setting basis text of the judgment questions and is generally obtained by arranging by a user, for example, the user arranges a set of common sense training texts of the staff members in the bank in advance and takes the common sense training texts as the original text set.
The embodiment of the invention utilizes the feature conversion layer to convert the original text set into the text feature set in a vector form. The method for converting the original text set into the text feature set in the form of vectors is the same as the forwarding method for converting the semi-masked text set into the semi-masked vector set when the part-of-speech tagging and word segmentation model is trained in step S1, and is not described here again.
And S3, performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set.
In the preferred embodiment of the invention, the part of speech tagging layer is used for carrying out part of speech prediction on the text feature set to obtain the part of speech of each word, and the part of speech of each word and the corresponding text feature are combined to obtain the part of speech feature set.
For example, the original text B exists in the common sense training text: "individual may decide to stop, reduce and avoid", through the feature conversion layer, original text B is converted into text features B in vector form:
Figure BDA0002839539060000071
and respectively performing part-of-speech prediction on each word in the text characteristics B through the part-of-speech tagging layer, and combining the prediction result of the part-of-speech with the text characteristics B to obtain part-of-speech characteristics:
Figure BDA0002839539060000072
wherein the content of the first and second substances,
Figure BDA0002839539060000073
representing a text feature B, each line of vectors representing one of the words of said text feature B,
Figure BDA0002839539060000074
the prediction result of the part of speech is shown as 1 [23 … 12 ]]Is represented by a noun, 3 denotes [14 … 51]Verbs, etc.
S4, calculating a word segmentation probability set of the part of speech feature set by using the word segmentation layer, and executing word segmentation operation on the part of speech feature set according to the word segmentation probability set to obtain a word feature set.
In detail, the calculating a word segmentation probability set of the part of speech feature set by using the word segmentation layer includes: converting the part of speech feature set into a part of speech vector set with fixed dimensions; and calculating the word segmentation probability of each part of speech vector in the part of speech vector set, and summarizing the word segmentation probability of each part of speech vector to obtain the word segmentation probability set.
In a preferred embodiment of the present invention, the fixed dimension is generally determined in advance by a user, and if the user determines that the fixed dimension is 1, the part-of-speech feature B is:
Figure BDA0002839539060000075
in (1)
Figure BDA0002839539060000076
Transition to [23 … 12 … 14 … 51]。
Further, the embodiment of the present invention sequentially inputs the [23 … 12 … 14 … 51] into the softmax function in the participle layer, calculates the participle probability [0.23 … 0.21 … 0.12.12 0.12 … 0.98],
further, the performing of the word segmentation operation on the part of speech feature set by using the word segmentation probability set means that, for example, the original text B: word segmentation probability corresponding to 'individual can decide to stop, reduce and avoid' [0.23 … 0.21 … 0.12 … 0.98]It means that the probability of segmenting the individual into "person" and "person" is 0.23, so that the individual does not need to perform the segmentation operation, and so on. After the word segmentation operation is finished, a word feature set is obtained, wherein the word feature set comprises words and parts of speech after word segmentation, such as the parts of speech corresponding to the original text B
Figure BDA0002839539060000081
And S5, performing weight division on the word feature set to obtain a word weight set.
Since the words of different parts of speech occupy different roles in a certain word, such as an adjective generally plays a role of modifying a noun or a verb, the role of the adjective is generally not more important than that of the noun or the verb, and therefore in the embodiment of the present invention, the word feature set is subjected to weight division according to the difference of parts of speech in the word feature set.
In detail, referring to fig. 3, the S5 includes:
s51, dividing the word feature set into an adjective feature set, a verb feature set and a noun feature set according to the part of speech corresponding to the word feature set;
and S52, according to the weight proportion of the adjectives, the verbs and the names which are constructed in advance, carrying out weight division on the adjective feature set, the verb feature set and the noun feature set to obtain the word weight set.
In one embodiment of the present invention, the weight ratio of the adjectives, verbs and nouns is 1:3:6, and the part of speech of the original text B is as described above
Figure BDA0002839539060000082
According to the weight ratio of 1:3:6, marking the weight of each adjective feature in the adjective feature set in the original text B as 0.1, marking the weight of each verb feature in the verb feature set in the original text B as 0.3, marking the weight of each noun feature in the noun feature set in the original text B as 0.6, and summarizing the marked adjective feature set, verb feature set and noun feature set to obtain the word weight set of 0.1
Figure BDA0002839539060000083
Wherein
Figure BDA0002839539060000084
From a weight ratio of 1:3:6, e.g.
Figure BDA0002839539060000085
Numeral 0.6 in (A) indicates the word [14 … 78]Is noun, the weight is 0.6.
And S6, performing partial masking operation on the word weight set to obtain a masked word set.
According to the weight of each part of speech in the word weight set, extracting a specified number of words from the word weight set to obtain a word combination set; and shielding and replacing the word combination set according to a preset proportion to obtain the shielded word set.
If the original text set includes original text: "the user may be anxious to wait for a number call, at which time the client manager needs a polite comforting user", and the weight ratio of adjectives, verbs and nouns recorded in the word weight set is 1:3:6, then from the original text: in the user waiting for number calling possibly urgently, at the moment, a client manager needs a polite comforting user, adjectives, verbs and nouns are sequentially extracted in a form of not changing the text description sequence, and the number ratio of the extracted adjectives, verbs and nouns is 1:3:6, so that the word combination set is obtained. The invention randomly selects words with preset proportion from the word combination set, for example, randomly selects words with preset proportion of 15%, and performs covering operation on the selected words. The masking operation comprises replacing 80% of the selected words with a preset symbol [ mask ], replacing 10% of the words with random words, keeping the remaining 10% of the words unchanged, and summarizing 15% of the words with the performed symbol replacement and random word replacement and the remaining 75% of the words to obtain the masked word set.
And S7, inputting the shielding word set into a pre-constructed judgment question generation model to generate a judgment question set.
In detail, the judgment question generation model comprises a BERT model, a full link layer and a softmax function which are obtained by training through a Chinese full word coverage method.
Further, the inputting the masking word set into a pre-constructed judgment question generation model to generate a judgment question set includes: the method comprises the steps of utilizing a BERT full word coverage model to conduct feature extraction on a shielding word set to obtain a shielding feature set, utilizing a full connection layer to convert the shielding feature set into a shielding vector set, using the shielding vector set as an input value of a softmax function, calculating to obtain a word prediction probability set of shielding words in the shielding word set, utilizing the word prediction probability set to replace an original text set, and generating a judgment question set.
In detail, compared with the BERT model in the part-of-speech tagging and word segmentation model, the BERT model obtained by training the Chinese full-word covering method has the advantages that the difference point is mainly in the aspect of model construction, the output value of the BERT model is changed, the output form of the original BERT model only outputting the text characteristics of non-shielding words is changed into the output form of simultaneously outputting the text characteristics of shielding words and the text characteristics of non-shielding words, and the shielding words are predicted through the full connection layer and the softmax function, so that the proposition rule of judgment questions is met.
As in original text B above: "person can decide to stop, reduce and avoid", one of the masked texts in the original text B is calculated as: and in the step of determining stop, reduction and avoidance, the characteristic processing is carried out on the step of determining stop, reduction and avoidance through the BERT full word coverage model to obtain the characteristic processing
Figure BDA0002839539060000101
Wherein [32 … 17]Text features representing the word are masked and are determined by comparing [32 … 17 ]]Inputting into the softmax function, calculating the probability maximum of the person, the probability value of the person is 'bank' and 'government' and then]And changing the original text B into a judgment question: the government may decide to stop, reduce and exempt, or the individual may decide to stop, reduce and exempt, or the bank may decide to stop, reduce and exempt.
The embodiment of the invention firstly constructs and trains to obtain a part-of-speech tagging and word segmentation model, and utilizes a characteristic conversion layer and a part-of-speech tagging layer in the part-of-speech tagging and word segmentation model to perform characteristic conversion and part-of-speech tagging on an original text set, compared with algorithms such as PCFG (pulse code generator) and the like in the background technology, the part-of-speech tagging and word segmentation model only performs word segmentation and part-of-speech tagging through a simple decision tree, uses a large number of data sets in the training process, further improves the part-of-speech tagging and word segmentation capability of the model, provides a better data basis for the generation of subsequent judgment questions, and in addition, in the embodiment of the invention, the importance of each word in the text is distinguished by combining weight division and partial masking, so that the subsequent judgment question generation model can generate judgment questions more in line with the human reading habit, the problems of poor readability and low accuracy of the generated judgment questions can be solved.
Fig. 4 is a schematic block diagram of a device for generating a judgment question based on a text according to the present invention.
The text-based question-of-judgment generating apparatus 100 according to the present invention may be installed in an electronic device. According to the realized function, the text-based judgment question generating device can comprise a part-of-speech tagging and word segmentation model building module 101, a word feature calculating module 102, a masked word generating module 103 and a judgment question generating module 104. A module according to the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the part-of-speech tagging and word segmentation model building module 101 is used for building and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
the word feature calculation module 102 is configured to receive an original text set, convert the original text set into a text feature set by using the feature conversion layer, perform part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set, calculate a word segmentation probability set of the part-of-speech feature set by using the word segmentation layer, and perform word segmentation on the part-of-speech feature set according to the word segmentation probability set to obtain a word feature set;
the masking word generating module 103 is configured to perform weight division on the word feature set to obtain a word weight set, and perform partial masking operation on the word weight set to obtain a masking word set;
the judgment question generation module 104 is configured to input the masking term set to a pre-constructed judgment question generation model to generate a judgment question set.
The module in the device provided by the application can solve the problems of poor readability and low accuracy of the generated judgment questions on the basis of the same text-based judgment question generation method as the text-based judgment question generation method.
Fig. 5 is a schematic structural diagram of an electronic device implementing the method for generating a judgment question based on a text according to the present invention.
The electronic device 1 may include a processor 10, a memory 11, and a bus, and may further include a computer program, such as a text-based question generator 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, which includes flash memory, removable hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only to store application software installed in the electronic device 1 and various types of data, such as codes of the text-based question generating program 12, but also to temporarily store data that has been output or is to be output.
The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device 1 by running or executing programs or modules (for example, executing a text-based question generation program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
Fig. 5 only shows an electronic device with components, and it will be understood by a person skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or a combination of certain components, or a different arrangement of components.
For example, although not shown, the electronic device 1 may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so as to implement functions of charge management, discharge management, power consumption management, and the like through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 1 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
Further, the electronic device 1 may further include a network interface, and optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), which are generally used for establishing a communication connection between the electronic device 1 and other electronic devices.
Optionally, the electronic device 1 may further comprise a user interface, which may be a Display (Display), an input unit (such as a Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic device 1 and for displaying a visualized user interface, among other things.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The text-based question generation program 12 stored in the memory 11 of the electronic device 1 is a combination of a plurality of instructions that, when executed in the processor 10, can implement:
constructing and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
receiving an original text set, and converting the original text set into a text feature set by using the feature conversion layer;
performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set;
calculating a word segmentation probability set of the part of speech characteristic set by using the word segmentation layer, and executing word segmentation operation on the part of speech characteristic set according to the word segmentation probability set to obtain a word characteristic set;
performing weight division on the word characteristic set to obtain a word weight set;
performing partial shielding operation on the word weight set to obtain a shielding word set;
and inputting the shielding word set into a pre-constructed judgment question generation model to generate a judgment question set.
Specifically, the specific implementation method of the processor 10 for the instruction may refer to the description of the relevant steps in the embodiments corresponding to fig. 1 to fig. 3, which is not repeated herein.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
constructing and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
receiving an original text set, and converting the original text set into a text feature set by using the feature conversion layer;
performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set;
calculating a word segmentation probability set of the part of speech characteristic set by using the word segmentation layer, and executing word segmentation operation on the part of speech characteristic set according to the word segmentation probability set to obtain a word characteristic set;
performing weight division on the word characteristic set to obtain a word weight set;
performing partial shielding operation on the word weight set to obtain a shielding word set;
and inputting the shielding word set into a pre-constructed judgment question generation model to generate a judgment question set.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A method for generating a judgment question based on a text, the method comprising:
constructing and training a part-of-speech tagging and word segmentation model, wherein the part-of-speech tagging and word segmentation model comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
receiving an original text set, and converting the original text set into a text feature set by using the feature conversion layer;
performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set;
calculating a word segmentation probability set of the part of speech characteristic set by using the word segmentation layer, and executing word segmentation operation on the part of speech characteristic set according to the word segmentation probability set to obtain a word characteristic set;
performing weight division on the word characteristic set to obtain a word weight set;
performing partial shielding operation on the word weight set to obtain a shielding word set;
and inputting the shielding word set into a pre-constructed judgment question generation model to generate a judgment question set.
2. The method of claim 1, wherein the constructing and training part-of-speech tagging and word segmentation models comprises:
receiving a training text set and a part-of-speech tag set corresponding to the training text set, and performing replacement and shielding operations on the training text set to obtain a semi-shielded text set;
constructing a part-of-speech tagging and word segmentation model, and calculating a part-of-speech prediction set of the semi-occlusion text set by using the part-of-speech tagging and word segmentation model;
and calculating a difference value between the part of speech prediction set and the part of speech tag set, and when the difference value is greater than or equal to a preset threshold value, adjusting internal parameters of the part of speech tagging and word segmentation model until the difference value is less than the preset threshold value to obtain the trained part of speech tagging and word segmentation model.
3. The method of claim 2, wherein the calculating a part-of-speech prediction set of the semi-occluded text set using the part-of-speech tagging and word segmentation model comprises:
converting the semi-occlusion text set into a semi-occlusion vector set by utilizing the characteristic conversion layer;
and performing part-of-speech prediction on the semi-occlusion vector set by utilizing the part-of-speech tagging layer to obtain the part-of-speech prediction set.
4. The method for generating judgment questions based on texts according to claim 1, wherein the calculating the segmentation probability set of the part of speech feature set by using the segmentation layer comprises:
converting the part of speech characteristic set into a part of speech vector set with fixed dimensions;
and calculating the word segmentation probability of each part of speech vector in the part of speech vector set, and summarizing the word segmentation probability of each part of speech vector to obtain the word segmentation probability set.
5. The method for generating judgment questions based on texts according to claim 1, wherein the performing weight division on the word feature sets to obtain word weight sets comprises:
according to the part of speech of the word feature set, dividing the word feature set into an adjective feature set, a verb feature set and a noun feature set;
and according to the weight proportion of the adjectives, the verbs and the nouns which are constructed in advance, carrying out weight division on the adjective feature set, the verb feature set and the noun feature set to obtain the word weight set.
6. The method of generating a judgment question based on a text according to claim 5, wherein the performing a partial masking operation on the word weight set to obtain a masked word set comprises:
extracting a specified number of words from the word weight set according to the weight of each part of speech in the word weight set to obtain a word combination set;
and executing a masking operation and a replacing operation on the word combination set according to a preset proportion to obtain the masked word set.
7. The method of any of claims 1-6, wherein the inputting the set of masked terms into a pre-constructed problem generation model to generate a problem set comprises:
carrying out feature extraction on the shielding word set to obtain a shielding feature set;
converting the set of occlusion features into a set of occlusion vectors;
performing calculation according to the shielding vector set by utilizing a softmax function to obtain a word prediction probability set of shielding words in the shielding word set;
and replacing the original text set by using the word prediction probability set to generate the judgment question set.
8. A text-based question generator, comprising:
the system comprises a part-of-speech tagging and word segmentation model building module, a word tagging and word segmentation model building module and a word segmentation model training module, wherein the part-of-speech tagging and word segmentation model building module is used for building and training a part-of-speech tagging and word segmentation model, and comprises a characteristic conversion layer, a part-of-speech tagging layer and a word segmentation layer;
the word feature calculation module is used for receiving an original text set, converting the original text set into a text feature set by using the feature conversion layer, performing part-of-speech tagging on the text feature set by using the part-of-speech tagging layer to obtain a part-of-speech feature set, calculating a word segmentation probability set of the part-of-speech feature set by using the word segmentation layer, and performing word segmentation operation on the part-of-speech feature set according to the word segmentation probability set to obtain a word feature set;
the masking word generating module is used for performing weight division on the word feature set to obtain a word weight set, and performing partial masking operation on the word weight set to obtain a masking word set;
and the judgment question generation module is used for inputting the shielding word set to a pre-constructed judgment question generation model to generate a judgment question set.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the text-based judgment question generating method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising a storage data area and a storage program area, wherein the storage data area stores created data, and the storage program area stores a computer program; wherein the computer program when executed by a processor implements the text-based judgment question generating method of any one of claims 1 to 7.
CN202011486652.2A 2020-12-16 2020-12-16 Text-based judgment question generation method and device, electronic equipment and storage medium Pending CN112507663A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011486652.2A CN112507663A (en) 2020-12-16 2020-12-16 Text-based judgment question generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011486652.2A CN112507663A (en) 2020-12-16 2020-12-16 Text-based judgment question generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112507663A true CN112507663A (en) 2021-03-16

Family

ID=74972649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011486652.2A Pending CN112507663A (en) 2020-12-16 2020-12-16 Text-based judgment question generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112507663A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204698A (en) * 2021-05-31 2021-08-03 平安科技(深圳)有限公司 News subject term generation method, device, equipment and medium
CN113627530A (en) * 2021-08-11 2021-11-09 中国平安人寿保险股份有限公司 Similar problem text generation method, device, equipment and medium
CN115221875A (en) * 2022-07-28 2022-10-21 平安科技(深圳)有限公司 Word weight generation method and device, electronic equipment and storage medium
CN116664253A (en) * 2023-07-28 2023-08-29 江西财经大学 Project recommendation method based on generalized matrix decomposition and attention shielding

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204698A (en) * 2021-05-31 2021-08-03 平安科技(深圳)有限公司 News subject term generation method, device, equipment and medium
CN113204698B (en) * 2021-05-31 2023-12-26 平安科技(深圳)有限公司 News subject term generation method, device, equipment and medium
CN113627530A (en) * 2021-08-11 2021-11-09 中国平安人寿保险股份有限公司 Similar problem text generation method, device, equipment and medium
CN113627530B (en) * 2021-08-11 2023-09-15 中国平安人寿保险股份有限公司 Similar problem text generation method, device, equipment and medium
CN115221875A (en) * 2022-07-28 2022-10-21 平安科技(深圳)有限公司 Word weight generation method and device, electronic equipment and storage medium
CN115221875B (en) * 2022-07-28 2023-06-20 平安科技(深圳)有限公司 Word weight generation method, device, electronic equipment and storage medium
CN116664253A (en) * 2023-07-28 2023-08-29 江西财经大学 Project recommendation method based on generalized matrix decomposition and attention shielding
CN116664253B (en) * 2023-07-28 2023-10-24 江西财经大学 Project recommendation method based on generalized matrix decomposition and attention shielding

Similar Documents

Publication Publication Date Title
CN112507663A (en) Text-based judgment question generation method and device, electronic equipment and storage medium
CN112541338A (en) Similar text matching method and device, electronic equipment and computer storage medium
CN113378970B (en) Sentence similarity detection method and device, electronic equipment and storage medium
CN111460797B (en) Keyword extraction method and device, electronic equipment and readable storage medium
CN114822812A (en) Character dialogue simulation method, device, equipment and storage medium
CN112528013A (en) Text abstract extraction method and device, electronic equipment and storage medium
CN113704429A (en) Semi-supervised learning-based intention identification method, device, equipment and medium
CN113821622B (en) Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
CN113515938A (en) Language model training method, device, equipment and computer readable storage medium
CN112559687A (en) Question identification and query method and device, electronic equipment and storage medium
CN113706322A (en) Service distribution method, device, equipment and storage medium based on data analysis
CN113205814A (en) Voice data labeling method and device, electronic equipment and storage medium
CN112883730A (en) Similar text matching method and device, electronic equipment and storage medium
CN113627160B (en) Text error correction method and device, electronic equipment and storage medium
CN113360654B (en) Text classification method, apparatus, electronic device and readable storage medium
CN113869456A (en) Sampling monitoring method and device, electronic equipment and storage medium
CN113204698A (en) News subject term generation method, device, equipment and medium
CN112507728A (en) Intelligent conversation method and device, electronic equipment and storage medium
CN116468025A (en) Electronic medical record structuring method and device, electronic equipment and storage medium
CN114186028A (en) Consult complaint work order processing method, device, equipment and storage medium
CN113628043A (en) Complaint validity judgment method, device, equipment and medium based on data classification
CN112734205A (en) Model confidence degree analysis method and device, electronic equipment and computer storage medium
CN111738005A (en) Named entity alignment method and device, electronic equipment and readable storage medium
CN112749264A (en) Problem distribution method and device based on intelligent robot, electronic equipment and storage medium
CN115221875B (en) Word weight generation method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination