# Application of Knowledge Map Based on BiLSTM-CRF Algorithm Model in Ideological and Political Education Question Answering System

Authors: Wei Zhao; Juan Liu
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Ideological and political education plays an important role in university education and is an important way to realize the function of educating people. It is of great significance to establish a perfect automatic question answering system for ideological and political education. Traditional automatic question answering methods usually rely on predicates and other prior information to achieve knowledge base question answering, which requires a lot of manpower and poor generalization ability. In order to solve this problem, this paper designs a question answering system for ideological and political education based on BiLSTM-CRF algorithm model (BiLSTM: Bidirectional Long Short-Term Memory and CRF: Conditional Random Fields). For the knowledge base question answering method with weak-dependent information, this paper combines BERT (Bidirectional Encoder Representation from Transformers) and BiLSTM-CRF network to extract the named entity in the questions and locate the triplet information related to the entity in the knowledge base. Through the answer matching network, the similarity score is marked for the answers in the triplet set, and the threshold selection strategy is used to select the answers that meet the requirements. And according to the similarity score from high to paper, it is presented to the user. The experimental results show that the method weakens the dependence on prior information, reduces manual intervention and ensures the quality of question answering, and completes the validity verification of the question answering system of ideological and political education.


---

## Body

## 1. Introduction

Strengthening the ideological and political education of college students is of great significance to the development of the country. College students in the new era should develop morally, intellectually, physically, and aesthetically and work in an all-round way. Only when college students develop in an all-round way the ideological and moral quality, scientific quality, and health quality in society can be improved [1]. Therefore, contemporary college students should not only have profound culture but also higher ideological and moral quality, ideological consciousness, and strong political sensitivity. Ideological and political education is an indispensable subject in today’s college students’ daily study. It can help college students keep calm and understand themselves correctly. The fundamental purpose of studying ideology and politics is to carry out these excellent virtues into the hearts of every college student [2].The knowledge map, also known as the scientific knowledge map, was formally proposed by Google in 2012 [3]. Its essence is a huge map, also known as the knowledge base of directed map structure, that is, the knowledge base of semantic web. In the knowledge map, nodes represent entities and edges represent relationships between entities. Representation learning of knowledge map aims to learn the vectorization representation of entities and relationships. TransE [4], a translation model based on multivariate relations, regards the relations in each triplet instance (head, relation, and tail) as the translation from the head entity to the tail entity. By constantly adjusting H, R, and T (representing head, relation, and tail, respectively), make (h+r) as equal to t as possible, that is, h+r≈T.At present, the Q&A research based on knowledge map has gradually changed from the previous research based on semantic parsing to the deep learning-based knowledge map Q&A research derived from information extraction. Literature [5] proposes to apply the representation learning method of word vector to Q&A based on knowledge map. Because the knowledge base always stores many facts in the form of triples, this paper proposes to treat the natural language question answering with a single relationship as the head entity and relationship of known triples, and find the tail entity of triples, namely, <subject, relation, ?>. The head entities and relations of the triplet are associated with the words in the question, and the correct answer to the question is the tail entities of the triplet. Inspired by this method, the relationship between questions and answers is expressed as a triplet, and the whole model is divided into two parts: entity recognition and relationship prediction. By improving the accuracy of the two parts, respectively, we can improve the accuracy of the correct answer of the returned question of the whole model. Most of the models use artificial defined entity matching rules in the screening of candidate master entities, which is cumbersome and has low accuracy. N-Gram [6] is an algorithm based on statistical language model, which can be used to evaluate the distance between two strings. It is a common method in fuzzy matching. That is, when two strings S and T are represented by the N-Gram algorithm, the length of the common part of the corresponding N-Gram substring is called the N-Gram distance. At present, most models use N-Gram algorithm to screen candidate entities [7]. However, using this algorithm alone cannot meet the needs of Q&A to locate candidate entities quickly and accurately. In this paper, N-Gram algorithm is used to establish inverted index for candidate entities, and the distance is used as the score of candidate entities to get candidate entity ranking, to locate the entities in questions into knowledge map quickly and accurately. In the entity recognition part of questions, most methods adopt the method of parsing syntactic and semantic information [8] to extract the features of questions, resulting in low accuracy of entity recognition. Literature [9] proposes a sequence labelling model combining BiLSTM and CRF, which can effectively predict current labels by using past and future feature labels. Therefore, the recognition rate of named entities is significantly higher than that of traditional methods.The attentional mechanism is essentially like the human selective visual attention mechanism. Its core goal is to select the information that is more critical to the current mission goal from a large amount of information. Literature [10, 11] designs a knowledge base Q&A combining attention and global information. By using the attentional mechanism to assign weight to each word in the question, the weight indicates the impact of different aspects of the answer on the question. Literature [10] divides the model into two parts, namely, the answer question end and the question answer end. The first part of the model uses the attention mechanism to calculate the similarity score between question vector and answer vector. The second part also calculates the different attention of the question vector at the answer end of the question to all aspects of the answer vector through the attention mechanism. Finally, the result of the second part is used as the weight of the similarity score of the first part, to get the final similarity score of the question vector and the answer vector. Inspired by the above methods, in the relationship prediction part of proposed model, attention mechanism is used to capture the semantic similarity between question vector and relationship vector. For similarity judgment of text or string, the existing methods and most experiments choose to use cosine value [12] to judge whether text or string is similar after vectorization. Literature [13] proposes to use image recognition method for text matching, construct text similarity matrix, and then use convolutional neural network to extract matrix features.Traditional automatic question answering methods usually rely on predicates and other prior information to achieve knowledge base question answering, which requires a lot of manpower and poor generalization ability. In order to solve this problem, this paper designs an answer matching strategy based on weakly dependent information with only known question pair information. By exploring the potential semantic connection between questions and answers, the efficiency of question answering can be improved. The innovations and contributions of this paper are listed below.(1)
For the knowledge base question answering method with weak-dependent information, this paper combines BERT and BiLSTM-CRF network to extract the named entity in the questions and locate the triplet information related to the entity in the knowledge base(2)
Through the answer matching network, the similarity score is marked for the answers in the triplet set, and the threshold selection strategy is used to select the answers that meet the requirements. And according to the similarity score from high to paper, it is presented to the userThe structure of this paper is listed as follows. The related work is described in the next section. The proposed question and answer system of ideological and political education is expressed in Section3. Section 4 focuses on the experiment and analysis. Section 5 is the conclusion.


## 2. Related Work

### 2.1. Development and Application of Question Answering System

The concept of question answering system has not been put forward for a long time, but it develops rapidly and has formed some relatively complete systems. The prototype system (FDUQA) developed by the Fudan University in China has achieved preliminary results. At the same time, the Harbin Institute of Technology (Jinshan customer service) and the Institute of Computing Technology of the Chinese Academy of Sciences are also conducting research in this field. The development of foreign countries is relatively mature. The world’s first Internet-based on question answering system, namely, START system [14], uses the mixed model of knowledge warehouse+information search. The knowledge base includes “START+KB” and “Internet+public+library” [15]. MULDER, the first question-answering system developed at the University of Washington, went one step further. Instead of a knowledge base, it draws on data from the Internet to analyse and produce a list of candidate answers. Each candidate answer will be given a confidence level, which can be taken as a reference by users [16].Due to the complexity of Chinese grammar and semantics, the development of intelligent question answering technology in China is relatively late. Now, it is based on artificial template and intelligent retrieval technology. Typical representatives are Huawei E, Xiaomi Ai, and so on. At present, the main intelligent question answering technologies in the world are computer retrieval, knowledge network, and deep learning. Apple’s Siri, Microsoft’s Cortana, and Google’s Google Now are good examples. At the same time, the rapid development of knowledge map provides high-quality knowledge source for the realization of intelligent question answering system, greatly accelerating the development of question answering system in the medical field [17]. This technology enables professionals to better help users learn, immerse, and use the connections between concepts of various entities in the real world.


### 2.2. Knowledge Map and Knowledge Base

Knowledge Map is also called scientific knowledge map. It was first proposed by Google in 2012 and published as a large-scale knowledge map based on Freebase [18] knowledge base and Wikipedia. It provides a referential means for the construction of world and domain knowledge [19]. The structure of knowledge map is the same as map, which is composed of nodes and edges. The nodes in the map represent the entities in the knowledge map, and the edges represent the relationship between entities [20].The knowledge base contains more knowledge information than the knowledge map. There are many different forms of knowledge in knowledge base, such as ontology knowledge, relevance knowledge, rule base, and case knowledge. A knowledge base question answer task is to answer a natural language question using one or more knowledge triples in the knowledge base. For example, ask a natural language question, “where is Beijing?”. You can use the fact that < Beijing, in China > to answer.Compared with the two concepts, the knowledge map lays more emphasis on the construction and visualization of correlation. It can use knowledge reasoning (such as rules) to quickly carry out knowledge mining and reasoning, to acquire new knowledge, and to discover new relationships between entities or concepts. Therefore, the Q&A system for liver disease was developed based on knowledge map. It will play an important role in solving the contradiction between the insufficient supply of high-quality medical resources and the increasing demand for medical services in China [21].


## 2.1. Development and Application of Question Answering System

The concept of question answering system has not been put forward for a long time, but it develops rapidly and has formed some relatively complete systems. The prototype system (FDUQA) developed by the Fudan University in China has achieved preliminary results. At the same time, the Harbin Institute of Technology (Jinshan customer service) and the Institute of Computing Technology of the Chinese Academy of Sciences are also conducting research in this field. The development of foreign countries is relatively mature. The world’s first Internet-based on question answering system, namely, START system [14], uses the mixed model of knowledge warehouse+information search. The knowledge base includes “START+KB” and “Internet+public+library” [15]. MULDER, the first question-answering system developed at the University of Washington, went one step further. Instead of a knowledge base, it draws on data from the Internet to analyse and produce a list of candidate answers. Each candidate answer will be given a confidence level, which can be taken as a reference by users [16].Due to the complexity of Chinese grammar and semantics, the development of intelligent question answering technology in China is relatively late. Now, it is based on artificial template and intelligent retrieval technology. Typical representatives are Huawei E, Xiaomi Ai, and so on. At present, the main intelligent question answering technologies in the world are computer retrieval, knowledge network, and deep learning. Apple’s Siri, Microsoft’s Cortana, and Google’s Google Now are good examples. At the same time, the rapid development of knowledge map provides high-quality knowledge source for the realization of intelligent question answering system, greatly accelerating the development of question answering system in the medical field [17]. This technology enables professionals to better help users learn, immerse, and use the connections between concepts of various entities in the real world.


## 2.2. Knowledge Map and Knowledge Base

Knowledge Map is also called scientific knowledge map. It was first proposed by Google in 2012 and published as a large-scale knowledge map based on Freebase [18] knowledge base and Wikipedia. It provides a referential means for the construction of world and domain knowledge [19]. The structure of knowledge map is the same as map, which is composed of nodes and edges. The nodes in the map represent the entities in the knowledge map, and the edges represent the relationship between entities [20].The knowledge base contains more knowledge information than the knowledge map. There are many different forms of knowledge in knowledge base, such as ontology knowledge, relevance knowledge, rule base, and case knowledge. A knowledge base question answer task is to answer a natural language question using one or more knowledge triples in the knowledge base. For example, ask a natural language question, “where is Beijing?”. You can use the fact that < Beijing, in China > to answer.Compared with the two concepts, the knowledge map lays more emphasis on the construction and visualization of correlation. It can use knowledge reasoning (such as rules) to quickly carry out knowledge mining and reasoning, to acquire new knowledge, and to discover new relationships between entities or concepts. Therefore, the Q&A system for liver disease was developed based on knowledge map. It will play an important role in solving the contradiction between the insufficient supply of high-quality medical resources and the increasing demand for medical services in China [21].


## 3. The Proposed Question and Answer System of Ideological and Political Education

### 3.1. Named Entity Recognition

The core of knowledge base question answering is to use named entity recognition algorithm to extract the entities in the question. Named entity recognition is a classical task in natural language processing and a subtask of sequence annotation. It realizes entity extraction by marking out the corresponding entity information for each position of input text. There are BIO and BIOES modes for entity labelling. In this paper, BIO mode is adopted for entity labelling. B-x represents the beginning of X entity, I-x represents the middle or end of X entity, and O represents nonentity content. Since only a single entity is involved in the questions of knowledge base question answering studied in this paper, only one entity type ENT is defined. For example, when entering the question “What is the core content of Ideological education?”. Entity annotation results are shown in Figure1.Figure 1
Result of entity annotation.The named entity recognition network model is shown in Figure2, which mainly includes feature extraction and entity annotation. In the process of feature extraction, input questions with mm length are segmented into word sequences m1,m2,⋯,mw and sent into BERT network to obtain w word vectors after word segmentation and word embedding. After feature extraction of transformer encoder in T layer, the feature matrix with length w of sequence and width d of hidden layer is obtained, to complete feature extraction. BiLSTM-CRF [22] network is usually used for overlapping named entity recognition in the process of entity annotation [23]. Firstly, the feature matrix is input into the bidirectional LSTM layer with t neurons in each direction to further extract the semantic association information of the context. Among them, f, h, and c represent forward, backward, and output neurons, respectively. The hidden dimension of the output new feature vector is 2t. This feature vector goes through a layer of feedforward neural network, and a vector with w length and width as the number of types to be labelled is obtained by linear transformation, which is used as the input of CRF layer.Figure 2
Named entity recognition network model.Since only one entity type is defined in this paper, the vector width is 3, representing the state scores of B, I, and O, respectively. In CRF layer, the random field probability model of linear chain parts calculates the output label sequence with the maximum conditional probability through the input feature sequence. This means that each position of the input question is marked with information. Through the statistics of the output annotation sequence, the starting and ending position of the entity can be located.In Belts-CRF network, for input vectori, the corresponding output is j, and its score is calculated as shown in
(1)Si,j=∑xbxjx+Ujx−1,jx,where b represents the three-dimensional vector output by BiLSTM layer, U represents the transfer characteristic matrix, and Ujx−1,jx represents the transfer score value of the output label from jx−1 to jx. The loss function adopts logarithmic likelihood function, and the objective function in minimization formula (2) during training is as follows:
(2)L=ln∑j′eSi,j′−Si,j.Since the dataset targeted at this paper is a single-hop question pair, the entities extracted from the questions are mostly single. If there are multiple entities, the first entity is usually the subject of the question, so it needs to be selected as a candidate entity.


### 3.2. Answer Matching

After the named entity recognition is completed, the extracted entity name is used as the keyword to generate the query statement of the knowledge base, and then, the triplet set containing the entity is retrieved and returned in the knowledge base to prepare for the answer matching. In Chinese knowledge base question answering, semantic matching is usually made between questions and predicates in triples. But this requires the original question pairs contained in the training data as well as the specific triplet information. However, task-specific question and answer datasets usually do not have such additional information and therefore require a lot of manual annotation or special preprocessing methods. The answer matching method proposed in this paper directly matches questions with answer information, only relies on the original question pair data during training, and calculates the matching degree between triplet answers and questions in the knowledge base during question answering. First, questions are preprocessed and named entities are removed to avoid interference of long questions and redundant information on answer matching. Then, the preprocessed questions were matched with each answer in the triplet set, and each answer was marked with a similarity score. The similarity score is a value between 0 and 1. Therefore, in the training process, if the input is the correct answer, the corresponding similarity score is labelled as 1; otherwise, the similarity score is labelled as 0.The answer matching network model is shown in Figure3. Q&A pairs begin with the [CLS][CLS] notation. In each match, the preprocessed question and answer are separated by [SEP][SEP] notation and connected into a sequence.Figure 3
Answer matching network model.The feature extraction process of answer matching network is like that of named entity recognition network. After BERT network, a feature matrix with lengthw+t and width d is obtained. Because the last layer of the network is sigmoid layer, it is a typical output layer of the classification network. Therefore, the characteristic matrix needs to be downsampled. The most important information in the feature matrix is extracted by using a pooling layer. Then, the first column of the characteristic matrix (length d) is extracted as the input of the sigmoid layer. Finally output through Sigmoid layer and get a value between 0 and 1, namely, similarity score.Because the last layer of the answer matching network is sigmoid layer, the loss function adopts the cross-entropy loss function. There are only 0 and 1 tags, and the structure of loss function is like that in binary classification task. In a similarity matching, if the sample label isj, the predicted similarity score is s, and the loss function is expressed as follows:
(3)L=−j·lns+1−j·ln1−s.


### 3.3. Threshold Selection

Through answer matching, each answer of the triplet set containing entities in the question is marked with similarity score. Then, select the appropriate answer based on these similarity scores. The simpler approach is to pick the answer with the highest similarity score, which works best in the traditional approach based on predicate matching. However, there will be some errors in the answer matching method proposed in this paper. This is because the similarity score obtained by answer matching is usually much smaller than that obtained by predicate matching; thus, the distinction between close answers is not high.The evaluation index of knowledge base Q&A is mainly F1 score (F). It is assumed that the standard answer and the predicted answer are in set form, and the F1 score is calculated by the accuracy (U) and recall (R). The accuracy rate represents the proportion of the predicted correct answers in the predicted answer set, reflecting the accuracy of the question answering system. Recall rate represents the proportion of predicted correct answers in the set of correct answers, reflecting the completeness of question answering system. A high-quality question answering system should maintain both high accuracy and recall values and evaluate its performance through F1 scores. Formula of F1 score is as follows:
(4)F=2×U×RU+R.If we want to build a question answering system with good performance, we can get a higher F1 score only by returning the answer set with similar similarity score in the answer selection and minimizing the errors and omissions of predicted answers at the same time. The threshold selection strategy adopted in this paper selects the appropriate similarity threshold through experimental comparison. Among them, the answers higher than the threshold value will be selected to form the set of predicted answers, which will be presented to users after sorting according to the similarity score, whereS represents the similarity score of each question, Sthreshold represents the set similarity threshold, and the selected status of each answer is H; H=1 indicates that the answer is selected, and H=0 indicates that the answer is not selected. The calculation formula is as follows:
(5)H=1,S⩾Sthreshold,0,S<Sthreshold.


## 3.1. Named Entity Recognition

The core of knowledge base question answering is to use named entity recognition algorithm to extract the entities in the question. Named entity recognition is a classical task in natural language processing and a subtask of sequence annotation. It realizes entity extraction by marking out the corresponding entity information for each position of input text. There are BIO and BIOES modes for entity labelling. In this paper, BIO mode is adopted for entity labelling. B-x represents the beginning of X entity, I-x represents the middle or end of X entity, and O represents nonentity content. Since only a single entity is involved in the questions of knowledge base question answering studied in this paper, only one entity type ENT is defined. For example, when entering the question “What is the core content of Ideological education?”. Entity annotation results are shown in Figure1.Figure 1
Result of entity annotation.The named entity recognition network model is shown in Figure2, which mainly includes feature extraction and entity annotation. In the process of feature extraction, input questions with mm length are segmented into word sequences m1,m2,⋯,mw and sent into BERT network to obtain w word vectors after word segmentation and word embedding. After feature extraction of transformer encoder in T layer, the feature matrix with length w of sequence and width d of hidden layer is obtained, to complete feature extraction. BiLSTM-CRF [22] network is usually used for overlapping named entity recognition in the process of entity annotation [23]. Firstly, the feature matrix is input into the bidirectional LSTM layer with t neurons in each direction to further extract the semantic association information of the context. Among them, f, h, and c represent forward, backward, and output neurons, respectively. The hidden dimension of the output new feature vector is 2t. This feature vector goes through a layer of feedforward neural network, and a vector with w length and width as the number of types to be labelled is obtained by linear transformation, which is used as the input of CRF layer.Figure 2
Named entity recognition network model.Since only one entity type is defined in this paper, the vector width is 3, representing the state scores of B, I, and O, respectively. In CRF layer, the random field probability model of linear chain parts calculates the output label sequence with the maximum conditional probability through the input feature sequence. This means that each position of the input question is marked with information. Through the statistics of the output annotation sequence, the starting and ending position of the entity can be located.In Belts-CRF network, for input vectori, the corresponding output is j, and its score is calculated as shown in
(1)Si,j=∑xbxjx+Ujx−1,jx,where b represents the three-dimensional vector output by BiLSTM layer, U represents the transfer characteristic matrix, and Ujx−1,jx represents the transfer score value of the output label from jx−1 to jx. The loss function adopts logarithmic likelihood function, and the objective function in minimization formula (2) during training is as follows:
(2)L=ln∑j′eSi,j′−Si,j.Since the dataset targeted at this paper is a single-hop question pair, the entities extracted from the questions are mostly single. If there are multiple entities, the first entity is usually the subject of the question, so it needs to be selected as a candidate entity.


## 3.2. Answer Matching

After the named entity recognition is completed, the extracted entity name is used as the keyword to generate the query statement of the knowledge base, and then, the triplet set containing the entity is retrieved and returned in the knowledge base to prepare for the answer matching. In Chinese knowledge base question answering, semantic matching is usually made between questions and predicates in triples. But this requires the original question pairs contained in the training data as well as the specific triplet information. However, task-specific question and answer datasets usually do not have such additional information and therefore require a lot of manual annotation or special preprocessing methods. The answer matching method proposed in this paper directly matches questions with answer information, only relies on the original question pair data during training, and calculates the matching degree between triplet answers and questions in the knowledge base during question answering. First, questions are preprocessed and named entities are removed to avoid interference of long questions and redundant information on answer matching. Then, the preprocessed questions were matched with each answer in the triplet set, and each answer was marked with a similarity score. The similarity score is a value between 0 and 1. Therefore, in the training process, if the input is the correct answer, the corresponding similarity score is labelled as 1; otherwise, the similarity score is labelled as 0.The answer matching network model is shown in Figure3. Q&A pairs begin with the [CLS][CLS] notation. In each match, the preprocessed question and answer are separated by [SEP][SEP] notation and connected into a sequence.Figure 3
Answer matching network model.The feature extraction process of answer matching network is like that of named entity recognition network. After BERT network, a feature matrix with lengthw+t and width d is obtained. Because the last layer of the network is sigmoid layer, it is a typical output layer of the classification network. Therefore, the characteristic matrix needs to be downsampled. The most important information in the feature matrix is extracted by using a pooling layer. Then, the first column of the characteristic matrix (length d) is extracted as the input of the sigmoid layer. Finally output through Sigmoid layer and get a value between 0 and 1, namely, similarity score.Because the last layer of the answer matching network is sigmoid layer, the loss function adopts the cross-entropy loss function. There are only 0 and 1 tags, and the structure of loss function is like that in binary classification task. In a similarity matching, if the sample label isj, the predicted similarity score is s, and the loss function is expressed as follows:
(3)L=−j·lns+1−j·ln1−s.


## 3.3. Threshold Selection

Through answer matching, each answer of the triplet set containing entities in the question is marked with similarity score. Then, select the appropriate answer based on these similarity scores. The simpler approach is to pick the answer with the highest similarity score, which works best in the traditional approach based on predicate matching. However, there will be some errors in the answer matching method proposed in this paper. This is because the similarity score obtained by answer matching is usually much smaller than that obtained by predicate matching; thus, the distinction between close answers is not high.The evaluation index of knowledge base Q&A is mainly F1 score (F). It is assumed that the standard answer and the predicted answer are in set form, and the F1 score is calculated by the accuracy (U) and recall (R). The accuracy rate represents the proportion of the predicted correct answers in the predicted answer set, reflecting the accuracy of the question answering system. Recall rate represents the proportion of predicted correct answers in the set of correct answers, reflecting the completeness of question answering system. A high-quality question answering system should maintain both high accuracy and recall values and evaluate its performance through F1 scores. Formula of F1 score is as follows:
(4)F=2×U×RU+R.If we want to build a question answering system with good performance, we can get a higher F1 score only by returning the answer set with similar similarity score in the answer selection and minimizing the errors and omissions of predicted answers at the same time. The threshold selection strategy adopted in this paper selects the appropriate similarity threshold through experimental comparison. Among them, the answers higher than the threshold value will be selected to form the set of predicted answers, which will be presented to users after sorting according to the similarity score, whereS represents the similarity score of each question, Sthreshold represents the set similarity threshold, and the selected status of each answer is H; H=1 indicates that the answer is selected, and H=0 indicates that the answer is not selected. The calculation formula is as follows:
(5)H=1,S⩾Sthreshold,0,S<Sthreshold.


## 4. Experiment and Analysis

### 4.1. Validation of the Algorithm Model

In order to verify the validity of the question answering system for ideological and political education designed in this paper, ccKS2019-CKBQA public evaluation data was firstly selected for experiment. Ccks2019-ckbqa public evaluation data includes 3 question and answer datasets and 1 open knowledge map. The evaluation data are constructed and annotated manually. The question-and-answer dataset contains 2 298 training sets, 766 validation sets (preliminary round), and 766 test sets (final round). Open knowledge map uses a large Chinese knowledge map PKUBASE. The map contains 41 009 141 entity knowledge triples, 13 930 117 entity mention triples and 25 182 627 entity type triples. In addition, the NLPCC2016-KBQA public evaluation data was added to the experiment in this paper due to too little training data of the relational extraction model. Since NLPCC2016-KBQA data mainly contains simple questions, ccKS2019-CKBQA data also contains many complex questions. Therefore, ccKS2019-CKBQA data were selected as experimental data in this paper.


#### 4.1.1. Experimental Settings

This paper is based on TensorFlow framework, with 12 layers of encoder. The output dimension of each layer of implicit state is 768, and the maximum length of Chinese question is 60. Adam algorithm was used to update and fine-tune the parameters of the model, and the initial learning rate was 2E-5. Batch training was used in the training, and the batch size was 32. The dropout ratio defaults to 0.1, the maximum number of iterations is 100, and the model is saved and the development set is validated every 50 steps during training.The evaluation indexes of experimental results include MACRO accuracyUmacro, macro recall rate Rmacro, and AVERAGE F1 value F1Average. The final ranking of evaluation results is based on the average F1 value. Assume that V is the set of all questions, Gx is the set of answers given for the x-th question, and Ax is the set of standard answers for the x-th question. The calculation of relevant indicators is shown in
(6)Umacro=1V∑x=1VUx,Ux=Gx∩AxGx,(7)Rmacro=1V∑x=1VRx,Rx=Gx∩AxAx,(8)F1Average=1V∑x=1V2UxRxUx+Rx.


#### 4.1.2. Experimental Results

Because the evaluation organizer only disclosed the standard answers to the validation set, the relevant experiments in this paper only tested on the validation set and presented the results of applying the model based on the method in this paper to the test set. Table1 shows the comparison between the results of the top four systems evaluated and the method presented in this paper. Among them, “evaluation no. 2” is the result of the integration of this system with other systems. As can be seen from Table 1, the method in this paper is slightly better than other four systems. It is worth noting that the top four systems evaluated all adopt a model fusion strategy. In this paper, a single model method is proposed, and good experimental results are obtained under the condition of simple structure, to verify the effectiveness of the system.Table 1
Performance comparison of different systems.
SystemPreliminary average F1 valueAverage F1 value of semifinalsEvaluate the 1st system71.90%74.76%Evaluate the 2nd system71.62%74.29%Evaluate the 3rd system68.44%71.66%Evaluate the 4th system67.60%68.89%Proposed71.97%74.89%


#### 4.1.3. Experimental Analysis

Table2 shows the performance comparison results of each submodel of the system in this paper. As can be seen from Table 3, the performance of entity reference recognition model is not high. In order to improve the recall rate of recognition, the left and right characters of candidate references recognized by the model are extended and deleted to increase the number of candidate entities. The accuracy of the single multihop classification model is only 90.23%, and the accuracy of the other models is more than 94%. Table 4 shows specific examples of classification errors. As you can see from Table 4, the multihop problem can be solved with a single-hop approach, where an alias reference can be linked to its subject entity without the need for extra triples.Table 2
Performance comparison of different submodels.
SubmodelsAccuracyEntity reference recognition model88.19%Single multihop classification model90.23%Subject-verb-object classification model94.66%Chain classification model95.33%Relational extraction classification model95.90%Entity link model99.78%Table 3
Automatic question answering results of various methods.
Automatic question answering methodTest set F1 scoreLiterature [24]72.24%Literature [25]82.59%Literature [26]83.71%Literature [27]84.18%Literature [28]85.95%Proposed88.29%Table 4
Examples of multihop classification errors.
Example sentencesSPARQLWhat is the basic line of the party?Select? y where{?X<name>” the Party<Basic line>?y.}What does Marxism Leninism reveal?Select? y where{?X<name>”Marxism-Leninism<What does it reveal>?y.}Considering the performance of the submodel, the question answering system in this paper does not divide Chinese questions into single-hop and multihop. Instead, a single-hop search is carried out for all the problems to improve the system performance [29, 30]. Since single-hop questions may also contain multiple entities, the system determines whether a question is a chained question or a multientity question based on whether it is chained. In addition, some questions are classified as chain problems but not multihop problems. Therefore, this paper adds a layer of constraint judgment to chain problems to reduce the influence caused by model classification errors.In the first system [31] in Table 1, the entity reference part does not adopt the sequence annotation model to identify but improves the accuracy of entity recognition by constructing dictionary for string matching and adding named entity recognizer. In the entity link part, the method proposed in this paper only retained the unique entity with the highest candidate score and did not increase the number of candidate entities, thus reducing the recall rate. In addition, the no. 1 evaluation system does not classify Chinese problems but uniformly uses a strategy based on path similarity matching. This strategy is semantically more accurate and reduces error propagation compared to strategies that only match entity relationships and issues. Therefore, entity path and problem matching methods are added to model fusion in this paper. In the future research, the system performance of this model can be improved by referring to the advantages of the no. 1 system.In order to verify the influence of different answer search modules on the system in this paper, experiments were carried out after one module was shielded. The results are shown in Table5. It can be seen from Table 5 that different search modules have a great impact on the overall performance of the system. If all problems are solved as simple problems, the F1 value of the system is only 53.25%. Compared with the simple problem, the F1 values of the proposed system for the complex problem of chain and multientity problems improved by 14.74 percentage points (67.99%-53.25%). Thus, the system’s strategy of setting different labels for Chinese questions is verified effectively.Table 5
System performance comparison under different module settings.
Module settingsAverage F1 valueOnly uniform single-hop search module53.25Shielded chain problem search module58.24Mask the multientity search module62.91No modules are shielded67.99


### 4.2. Application of Question Answering System for Ideological and Political Education in Colleges and Universities

In order to verify the application effect of the university ideological and political education question-answering system designed in this paper, 100 college students from the class of 2021 majoring in ideological and political education in a Chinese university were randomly selected as the application objects. Users input their ideological and political knowledge into the system and then investigate and analyse whether their doubts have been solved. Thus, judge the practical effect of the system. In the practical application of the question answering system, the threshold is selected as an optional switch. In many application scenarios, the Q&A task requires a single answer to be returned, at which point the threshold selection switch is turned off and the answer with the highest similarity is presented to the user. If the user is confused about the answer, or some scenarios allow multiple answers to be returned, the threshold selection can be turned on to present the candidate answer set in the order of similarity from high to low.In order to compare with other existing question answering systems, literature [24], literature [25], literature [26], literature [27], and literature [28] are selected as comparison methods. The results of the Q&A are shown in Table 3. Literature [24] is based on the idea of dynamic programming. Its unsupervised idea has reference significance, but the effect of the Q&A is limited. Literature [25] is the NLPCC-ICCPOL-2016 KBQA task score of the top 5 question-answering methods. It mainly relies on some manual rules to ensure the performance of question answering. For example, literature [25] constructs regular expressions to remove redundant information in questions, and NUDT uses combined features of parts of speech to realize named entity recognition. Literature [26] is a question-answering method based on attribute mapping of predicates in knowledge base triples, with a few artificial features added.Literature [27] is an automatic question answering method implemented through syntactic analysis. Literature [28] applied BERT to feature extraction on the dataset and obtained the best results publicly.This method combines BERT and BiLSTM-CRF networks to extract named entities in questions and locate triples related to the entities in the knowledge base. Through the answer matching network, the answers in the triplet set are marked with the similarity score, and the threshold selection strategy is used to select the answers that meet the requirements, and then, the answers are presented to the user in order of the similarity score from high to paper. This process reduces the need for manual annotation and preprocessing, and the test set F1 score is 88.29%, which has the best performance.


## 4.1. Validation of the Algorithm Model

In order to verify the validity of the question answering system for ideological and political education designed in this paper, ccKS2019-CKBQA public evaluation data was firstly selected for experiment. Ccks2019-ckbqa public evaluation data includes 3 question and answer datasets and 1 open knowledge map. The evaluation data are constructed and annotated manually. The question-and-answer dataset contains 2 298 training sets, 766 validation sets (preliminary round), and 766 test sets (final round). Open knowledge map uses a large Chinese knowledge map PKUBASE. The map contains 41 009 141 entity knowledge triples, 13 930 117 entity mention triples and 25 182 627 entity type triples. In addition, the NLPCC2016-KBQA public evaluation data was added to the experiment in this paper due to too little training data of the relational extraction model. Since NLPCC2016-KBQA data mainly contains simple questions, ccKS2019-CKBQA data also contains many complex questions. Therefore, ccKS2019-CKBQA data were selected as experimental data in this paper.


### 4.1.1. Experimental Settings

This paper is based on TensorFlow framework, with 12 layers of encoder. The output dimension of each layer of implicit state is 768, and the maximum length of Chinese question is 60. Adam algorithm was used to update and fine-tune the parameters of the model, and the initial learning rate was 2E-5. Batch training was used in the training, and the batch size was 32. The dropout ratio defaults to 0.1, the maximum number of iterations is 100, and the model is saved and the development set is validated every 50 steps during training.The evaluation indexes of experimental results include MACRO accuracyUmacro, macro recall rate Rmacro, and AVERAGE F1 value F1Average. The final ranking of evaluation results is based on the average F1 value. Assume that V is the set of all questions, Gx is the set of answers given for the x-th question, and Ax is the set of standard answers for the x-th question. The calculation of relevant indicators is shown in
(6)Umacro=1V∑x=1VUx,Ux=Gx∩AxGx,(7)Rmacro=1V∑x=1VRx,Rx=Gx∩AxAx,(8)F1Average=1V∑x=1V2UxRxUx+Rx.


### 4.1.2. Experimental Results

Because the evaluation organizer only disclosed the standard answers to the validation set, the relevant experiments in this paper only tested on the validation set and presented the results of applying the model based on the method in this paper to the test set. Table1 shows the comparison between the results of the top four systems evaluated and the method presented in this paper. Among them, “evaluation no. 2” is the result of the integration of this system with other systems. As can be seen from Table 1, the method in this paper is slightly better than other four systems. It is worth noting that the top four systems evaluated all adopt a model fusion strategy. In this paper, a single model method is proposed, and good experimental results are obtained under the condition of simple structure, to verify the effectiveness of the system.Table 1
Performance comparison of different systems.
SystemPreliminary average F1 valueAverage F1 value of semifinalsEvaluate the 1st system71.90%74.76%Evaluate the 2nd system71.62%74.29%Evaluate the 3rd system68.44%71.66%Evaluate the 4th system67.60%68.89%Proposed71.97%74.89%


### 4.1.3. Experimental Analysis

Table2 shows the performance comparison results of each submodel of the system in this paper. As can be seen from Table 3, the performance of entity reference recognition model is not high. In order to improve the recall rate of recognition, the left and right characters of candidate references recognized by the model are extended and deleted to increase the number of candidate entities. The accuracy of the single multihop classification model is only 90.23%, and the accuracy of the other models is more than 94%. Table 4 shows specific examples of classification errors. As you can see from Table 4, the multihop problem can be solved with a single-hop approach, where an alias reference can be linked to its subject entity without the need for extra triples.Table 2
Performance comparison of different submodels.
SubmodelsAccuracyEntity reference recognition model88.19%Single multihop classification model90.23%Subject-verb-object classification model94.66%Chain classification model95.33%Relational extraction classification model95.90%Entity link model99.78%Table 3
Automatic question answering results of various methods.
Automatic question answering methodTest set F1 scoreLiterature [24]72.24%Literature [25]82.59%Literature [26]83.71%Literature [27]84.18%Literature [28]85.95%Proposed88.29%Table 4
Examples of multihop classification errors.
Example sentencesSPARQLWhat is the basic line of the party?Select? y where{?X<name>” the Party<Basic line>?y.}What does Marxism Leninism reveal?Select? y where{?X<name>”Marxism-Leninism<What does it reveal>?y.}Considering the performance of the submodel, the question answering system in this paper does not divide Chinese questions into single-hop and multihop. Instead, a single-hop search is carried out for all the problems to improve the system performance [29, 30]. Since single-hop questions may also contain multiple entities, the system determines whether a question is a chained question or a multientity question based on whether it is chained. In addition, some questions are classified as chain problems but not multihop problems. Therefore, this paper adds a layer of constraint judgment to chain problems to reduce the influence caused by model classification errors.In the first system [31] in Table 1, the entity reference part does not adopt the sequence annotation model to identify but improves the accuracy of entity recognition by constructing dictionary for string matching and adding named entity recognizer. In the entity link part, the method proposed in this paper only retained the unique entity with the highest candidate score and did not increase the number of candidate entities, thus reducing the recall rate. In addition, the no. 1 evaluation system does not classify Chinese problems but uniformly uses a strategy based on path similarity matching. This strategy is semantically more accurate and reduces error propagation compared to strategies that only match entity relationships and issues. Therefore, entity path and problem matching methods are added to model fusion in this paper. In the future research, the system performance of this model can be improved by referring to the advantages of the no. 1 system.In order to verify the influence of different answer search modules on the system in this paper, experiments were carried out after one module was shielded. The results are shown in Table5. It can be seen from Table 5 that different search modules have a great impact on the overall performance of the system. If all problems are solved as simple problems, the F1 value of the system is only 53.25%. Compared with the simple problem, the F1 values of the proposed system for the complex problem of chain and multientity problems improved by 14.74 percentage points (67.99%-53.25%). Thus, the system’s strategy of setting different labels for Chinese questions is verified effectively.Table 5
System performance comparison under different module settings.
Module settingsAverage F1 valueOnly uniform single-hop search module53.25Shielded chain problem search module58.24Mask the multientity search module62.91No modules are shielded67.99


## 4.1.1. Experimental Settings

This paper is based on TensorFlow framework, with 12 layers of encoder. The output dimension of each layer of implicit state is 768, and the maximum length of Chinese question is 60. Adam algorithm was used to update and fine-tune the parameters of the model, and the initial learning rate was 2E-5. Batch training was used in the training, and the batch size was 32. The dropout ratio defaults to 0.1, the maximum number of iterations is 100, and the model is saved and the development set is validated every 50 steps during training.The evaluation indexes of experimental results include MACRO accuracyUmacro, macro recall rate Rmacro, and AVERAGE F1 value F1Average. The final ranking of evaluation results is based on the average F1 value. Assume that V is the set of all questions, Gx is the set of answers given for the x-th question, and Ax is the set of standard answers for the x-th question. The calculation of relevant indicators is shown in
(6)Umacro=1V∑x=1VUx,Ux=Gx∩AxGx,(7)Rmacro=1V∑x=1VRx,Rx=Gx∩AxAx,(8)F1Average=1V∑x=1V2UxRxUx+Rx.


## 4.1.2. Experimental Results

Because the evaluation organizer only disclosed the standard answers to the validation set, the relevant experiments in this paper only tested on the validation set and presented the results of applying the model based on the method in this paper to the test set. Table1 shows the comparison between the results of the top four systems evaluated and the method presented in this paper. Among them, “evaluation no. 2” is the result of the integration of this system with other systems. As can be seen from Table 1, the method in this paper is slightly better than other four systems. It is worth noting that the top four systems evaluated all adopt a model fusion strategy. In this paper, a single model method is proposed, and good experimental results are obtained under the condition of simple structure, to verify the effectiveness of the system.Table 1
Performance comparison of different systems.
SystemPreliminary average F1 valueAverage F1 value of semifinalsEvaluate the 1st system71.90%74.76%Evaluate the 2nd system71.62%74.29%Evaluate the 3rd system68.44%71.66%Evaluate the 4th system67.60%68.89%Proposed71.97%74.89%


## 4.1.3. Experimental Analysis

Table2 shows the performance comparison results of each submodel of the system in this paper. As can be seen from Table 3, the performance of entity reference recognition model is not high. In order to improve the recall rate of recognition, the left and right characters of candidate references recognized by the model are extended and deleted to increase the number of candidate entities. The accuracy of the single multihop classification model is only 90.23%, and the accuracy of the other models is more than 94%. Table 4 shows specific examples of classification errors. As you can see from Table 4, the multihop problem can be solved with a single-hop approach, where an alias reference can be linked to its subject entity without the need for extra triples.Table 2
Performance comparison of different submodels.
SubmodelsAccuracyEntity reference recognition model88.19%Single multihop classification model90.23%Subject-verb-object classification model94.66%Chain classification model95.33%Relational extraction classification model95.90%Entity link model99.78%Table 3
Automatic question answering results of various methods.
Automatic question answering methodTest set F1 scoreLiterature [24]72.24%Literature [25]82.59%Literature [26]83.71%Literature [27]84.18%Literature [28]85.95%Proposed88.29%Table 4
Examples of multihop classification errors.
Example sentencesSPARQLWhat is the basic line of the party?Select? y where{?X<name>” the Party<Basic line>?y.}What does Marxism Leninism reveal?Select? y where{?X<name>”Marxism-Leninism<What does it reveal>?y.}Considering the performance of the submodel, the question answering system in this paper does not divide Chinese questions into single-hop and multihop. Instead, a single-hop search is carried out for all the problems to improve the system performance [29, 30]. Since single-hop questions may also contain multiple entities, the system determines whether a question is a chained question or a multientity question based on whether it is chained. In addition, some questions are classified as chain problems but not multihop problems. Therefore, this paper adds a layer of constraint judgment to chain problems to reduce the influence caused by model classification errors.In the first system [31] in Table 1, the entity reference part does not adopt the sequence annotation model to identify but improves the accuracy of entity recognition by constructing dictionary for string matching and adding named entity recognizer. In the entity link part, the method proposed in this paper only retained the unique entity with the highest candidate score and did not increase the number of candidate entities, thus reducing the recall rate. In addition, the no. 1 evaluation system does not classify Chinese problems but uniformly uses a strategy based on path similarity matching. This strategy is semantically more accurate and reduces error propagation compared to strategies that only match entity relationships and issues. Therefore, entity path and problem matching methods are added to model fusion in this paper. In the future research, the system performance of this model can be improved by referring to the advantages of the no. 1 system.In order to verify the influence of different answer search modules on the system in this paper, experiments were carried out after one module was shielded. The results are shown in Table5. It can be seen from Table 5 that different search modules have a great impact on the overall performance of the system. If all problems are solved as simple problems, the F1 value of the system is only 53.25%. Compared with the simple problem, the F1 values of the proposed system for the complex problem of chain and multientity problems improved by 14.74 percentage points (67.99%-53.25%). Thus, the system’s strategy of setting different labels for Chinese questions is verified effectively.Table 5
System performance comparison under different module settings.
Module settingsAverage F1 valueOnly uniform single-hop search module53.25Shielded chain problem search module58.24Mask the multientity search module62.91No modules are shielded67.99


## 4.2. Application of Question Answering System for Ideological and Political Education in Colleges and Universities

In order to verify the application effect of the university ideological and political education question-answering system designed in this paper, 100 college students from the class of 2021 majoring in ideological and political education in a Chinese university were randomly selected as the application objects. Users input their ideological and political knowledge into the system and then investigate and analyse whether their doubts have been solved. Thus, judge the practical effect of the system. In the practical application of the question answering system, the threshold is selected as an optional switch. In many application scenarios, the Q&A task requires a single answer to be returned, at which point the threshold selection switch is turned off and the answer with the highest similarity is presented to the user. If the user is confused about the answer, or some scenarios allow multiple answers to be returned, the threshold selection can be turned on to present the candidate answer set in the order of similarity from high to low.In order to compare with other existing question answering systems, literature [24], literature [25], literature [26], literature [27], and literature [28] are selected as comparison methods. The results of the Q&A are shown in Table 3. Literature [24] is based on the idea of dynamic programming. Its unsupervised idea has reference significance, but the effect of the Q&A is limited. Literature [25] is the NLPCC-ICCPOL-2016 KBQA task score of the top 5 question-answering methods. It mainly relies on some manual rules to ensure the performance of question answering. For example, literature [25] constructs regular expressions to remove redundant information in questions, and NUDT uses combined features of parts of speech to realize named entity recognition. Literature [26] is a question-answering method based on attribute mapping of predicates in knowledge base triples, with a few artificial features added.Literature [27] is an automatic question answering method implemented through syntactic analysis. Literature [28] applied BERT to feature extraction on the dataset and obtained the best results publicly.This method combines BERT and BiLSTM-CRF networks to extract named entities in questions and locate triples related to the entities in the knowledge base. Through the answer matching network, the answers in the triplet set are marked with the similarity score, and the threshold selection strategy is used to select the answers that meet the requirements, and then, the answers are presented to the user in order of the similarity score from high to paper. This process reduces the need for manual annotation and preprocessing, and the test set F1 score is 88.29%, which has the best performance.


## 5. Conclusion

To weaken the dependence of ideological and political education question answering system on prior information and ensure the quality of question answering while reducing human intervention, this paper proposes a kind of ideological and political education question answering system based on BILSTM-CRF algorithm model. It uses named entity recognition network to extract the entity in the question and obtains the set of related triples based on the entity name keyword. The answer matching network was used to label the similarity score for each answer. Finally, the alternative answers are filtered through threshold selection and the results are output. The experimental results show that the question answering system of ideological and political education designed in this paper weakens the dependence on predicates and other prior information in the question answering data and has good generalization performance. Through the experiments, it is found that the accuracy of the question answering system for ideological and political education in this paper needs to be improved in terms of the number type of answers. In the future, representation learning and other methods will be used to select the optimal answer from the candidate answer set to further improve the quality of question answering.



---

*Source: 4139323-2022-05-13.xml*