Intelligent question-answering method based on traditional cultural knowledge graph

By constructing a traditional culture knowledge graph and a named entity recognition network, the problem of digitizing traditional culture knowledge was solved, achieving highly accurate intelligent question answering and improving the efficiency of traditional culture protection and inheritance.

CN117093681BActive Publication Date: 2025-11-04SHAANXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310821295.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2025-11-04
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

Existing search engines cannot provide accurate answers, and there are difficulties in digitizing traditional cultural knowledge, resulting in poor user experience and posing challenges to the protection and inheritance of traditional cultural knowledge.

Method used

We construct a knowledge graph of traditional culture, and achieve intelligent question answering by collecting, preprocessing, building datasets and relation dictionaries, and using named entity recognition networks and graph databases. This includes a word embedding layer, a bidirectional long short-term memory neural network, and an attention mechanism layer. We combine conditional random fields for training and testing, and use the Cypher query language to obtain answers.

Benefits of technology

It achieves highly accurate intelligent question answering of traditional cultural knowledge, provides convenient human-computer interaction, protects and inherits outstanding Chinese culture, and improves the efficiency of cultural knowledge retrieval and utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117093681B_ABST
    Figure CN117093681B_ABST
Patent Text Reader

Abstract

An intelligent question and answer method based on traditional culture knowledge graph, which is composed of the steps of collecting traditional culture knowledge, traditional culture data preprocessing, constructing traditional culture data set, constructing name relation dictionary, constructing traditional culture knowledge graph, constructing named entity recognition network, training named entity recognition network, testing named entity recognition network, named entity recognition, intent recognition, querying answer, and displaying question and answer result. On the basis of constructing traditional culture knowledge graph, the intelligent question and answer method is explored, a convenient man-machine interaction mode is provided, the shortcomings of the general search system are made up, good application effect is achieved in the retrieval and utilization of cultural knowledge, digital cultural service is realized, the user can obtain the answer in the shortest time, and the intelligent question and answer method has the advantages of accurate problem solving and fast speed, and can realize intelligent answering of traditional culture knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of knowledge graph, and particularly relates to an intelligent question answering method based on traditional cultural knowledge graph. TECHNICAL BACKGROUND

[0002] Since Google proposed the concept of knowledge graph in 2012, knowledge graph has received extensive attention and application research. Knowledge graph is a knowledge base that represents entities and their relationships in the form of a graph. It obtains prior knowledge by simulating the way humans understand the objective world, enabling machines to understand semantics. It is mainly used to optimize existing search engines, including semantic search, question answering (QA), analysis and decision driving knowledge of big data, etc. Therefore, in recent years, the academic and industrial circles have gradually combined knowledge graph to expand related upper intelligent applications.

[0003] Traditional search engines can only return multiple web pages and cannot give more accurate answers. For users, it is necessary to analyze and screen from the web pages, and the search experience is poor. Traditional search engines only do "matching" instead of "understanding" natural language input by users.

[0004] For traditional culture, especially opera, folk song and national dance, with the emergence of more modern entertainment ways, fewer and fewer people pay attention to, understand and inherit Chinese excellent traditional culture. In addition, a lot of knowledge related to opera, folk song and national dance exists in the oral tradition of the older generation, and it is difficult to digitize these knowledge data. Therefore, it is urgent to establish a related knowledge system of traditional culture. SUMMARY

[0005] The technical problem to be solved by the application is to overcome the shortcomings of the prior art, and provide an intelligent question answering method based on traditional cultural knowledge graph with high accuracy, reliability and convenience.

[0006] The technical solution for solving the above technical problem is composed of the following steps:

[0007] (1) Collecting traditional cultural knowledge

[0008] Find the knowledge about traditional culture from the national folk cultural resource management system, and extract the data of names, introductions, types and nationalities in opera, folk song and traditional dance.

[0009] (2) Traditional cultural data preprocessing

[0010] Delete, replace and clean the meaningless characters, random codes and invalid data, and remove the unnecessary fields in each data.

[0011] (3) Constructing traditional cultural data set

[0012] Traditional cultural knowledge is processed into a traditional cultural dataset Y, Y ∈ {a n ,b n ,c n ,d n ,e n ,f n}, where a n represents the identifier of each piece of data, b n represents the name of each piece of data, c n represents the introduction of each piece of data, d n represents the type of each piece of data, e n represents the nationality of the source of each piece of data, f n is the detailed introduction of each piece of data, and n represents each piece of traditional cultural knowledge data, n is at least 10000, and the dataset Y is divided into training set and test set according to the proportion of 7:3.

[0013] (4) Construct a name relationship dictionary

[0014] The name b n of each piece of data in the dataset Y is input into the name dictionary N, N ∈ {b1,b2,...,b n}, and the relationship type of the dataset Y, including introduction c, type d, nationality e, and detailed introduction f, is input into the relationship dictionary R, R ∈ {c,d,e,f}.

[0015] (5) Construct a traditional cultural knowledge graph

[0016] The dataset Y includes the following categories:

[0017] Y={Op,Fs,Nd}

[0018] Where Op represents opera data, Fs represents folk song data, and Nd represents national dance data.

[0019] The opera data Op includes the following categories:

[0020] Op={Oc,Om,Or}

[0021] Where Oc represents opera category data, Om represents opera character data, and Or represents classic opera data.

[0022] The folk song data Fs includes the following categories:

[0023] Fs={Fc,Fi,Fp,Fo}

[0024] Where Fc represents folk song category data, Fi represents folk song instrument data, Fp represents folk song celebrity data, and Fo represents classic folk music data.

[0025] The dance data Nd includes the following categories:

[0026] Nd={Nt,Np}

[0027] Wherein, Nt represents traditional dance data, Np represents dance celebrity data.

[0028] Three large categories are the first level ontology class of the knowledge graph, and nine small categories are the second level ontology class of the knowledge graph. The data of the first level ontology class is taken as the center, and the data of the second level ontology class is taken around the first level ontology class to obtain the traditional culture knowledge graph mode layer; the name b of the data set Y n is the first entity node, the introduction c, the type d, the nationality e and the detailed introduction f of the data set Y are the relationship nodes, and c n , d n , e n , f n in the data set Y are the second entity nodes. The first entity node, the relationship node and the second entity node are constructed into the output T of the triple according to the following formula:

[0029] T={b n ,Ra,(c n , d n , e n , f n )},

[0030] Wherein, b n represents the first entity node in the triple, Ra represents the relationship node of the triple, and (c n , d n , e n , f n ) represents the second entity node of the triple. The data set Y is converted into 40000 triple data to obtain the data layer of the knowledge graph. The triple data is stored in the graph database to construct the visual traditional culture knowledge graph.

[0031] (6) Constructing a named entity recognition network

[0032] The named entity recognition network is composed of a word embedding layer, a bidirectional long short-term memory neural network, an attention mechanism layer and a conditional random field (CRF) layer connected in sequence.

[0033] (7) Training the named entity recognition network

[0034] The cross-entropy loss function L(y, a) is determined according to the following formula:

[0035] L(y, a)=y×lna+(1-y)×ln(1-a)

[0036] Wherein, y is the true value, y takes the value of 0 or 1, a is the predicted value, and a∈(0,1).

[0037] The training set is input into the named entity recognition network, the learning rate r of the named entity recognition network is in [10 -5 , 10 -3 ], the number of training rounds is [10, 15], the batch size of each training round is 10, the optimizer is Adam, and the training is iterated until the cross-entropy loss function L(y, a) converges.

[0038] (8) Test the named entity recognition network

[0039] The test set is input into the named entity recognition network for testing.

[0040] (9) Named entity recognition

[0041] The user input question text is input into the trained named entity recognition network for named entity recognition, and the recognized traditional culture name S is output, S∈{s1,s2,...,s j}, s j represents the jth traditional culture name, j takes a value of 1-10, and the data in the traditional culture name S is compared with the data in the name dictionary N one by one, and the comparison result is input into a new list P:

[0042] P=compare(S,N)

[0043] Where compare is the comparison function.

[0044] (10) Intention recognition

[0045] The user input question text K is compared with the relationship types stored in the relationship data dictionary R one by one, and the comparison result is input into a new list Q:

[0046] Q=compare(K,Q)

[0047] Where compare is the comparison function.

[0048] (11) Query answer

[0049] The recognition results of steps (9) and (10) are used to query the second entity node in the knowledge graph using the query language Cypher of the graph database, and the query result is the answer of the user.

[0050] (12) Show the question and answer result

[0051] The user sends a question in a chat window, the script uses asynchronous transmission to send the question to the server, the server calls the object of the class to find the answer in the backend question and answer system, the script receives the answer and displays it; the display of the question and answer result is abnormally handled, if the result is successfully queried in step (11), the system normally returns the answer to the user through the front end; if the system makes a mistake in the identification process of steps (9) and (10), the system prompts the user to input an error, and the user re-enters; if the knowledge base cannot be connected, the user is fed back that the server has an error, and the administrator is contacted for repair.

[0052] In the step (6) of constructing the named entity recognition network of the application, the word embedding layer is sequentially connected by an input layer, a hidden layer and an output layer.

[0053] In the step (6) of constructing the named entity recognition network of the application, the bidirectional long short-term memory neural network is composed of a forward long short-term memory neural network and a reverse long short-term neural network in parallel; the forward long short-term memory neural network is sequentially connected by a forgetting gate f and an input gate i, an output gate o and a hidden layer; the reverse long short-term memory neural network has the same structure as the forward long short-term memory neural network. t In the step (6) of constructing the named entity recognition network of the application, the bidirectional long short-term memory neural network is composed of a forward long short-term memory neural network and a reverse long short-term neural network in parallel; the forward long short-term memory neural network is sequentially connected by a forgetting gate f and an input gate i, an output gate o and a hidden layer; the reverse long short-term memory neural network has the same structure as the forward long short-term memory neural network.

[0054] The forgetting gate f is determined according to the following formula t :

[0055] f t =σ(W f ·x t +V f ·h t-1 +b f )

[0056] Wherein, sigma represents a sigmoid activation function, · represents a dot product operation, W f , V f respectively are weights, and b f represents a bias of a linear relationship.

[0057] The input gate i is determined according to the following formula t :

[0058] i t =σ(W i ·x t +V i ·h t-1 +b i )

[0059] Wherein, W i , V i respectively represent weights, and b i represents a bias.

[0060] The output gate o is determined according to the following formulat :

[0061] o t = sigma(W o ·x t + V c ·h t-1 + b o )

[0062] where W o , V c represent weights respectively, and b o is a bias.

[0063] In the step (6) of constructing the named entity recognition network of the application, the attention mechanism layer is composed of three parallel full connection layers, dot product operation layers, connection function layers and full connection layers connected in sequence.

[0064] Compared with the prior art, the application has the following advantages:

[0065] The application extracts a large amount of knowledge data in traditional culture, constructs a knowledge graph based on traditional culture, realizes traditional culture semantic search, knowledge reasoning, relationship mining, automatic recommendation, intelligent question answering, and establishes a knowledge system of traditional culture, which has a profound significance for protecting and carrying forward the excellent traditional culture of China.

[0066] On the basis of constructing the traditional culture knowledge graph, the application explores an intelligent question answering method, provides a convenient man-machine interaction mode, makes up for the deficiency of the general search system, achieves good application effect in the retrieval and utilization of cultural knowledge, realizes digital cultural service, and helps users to obtain answers in the shortest time. BRIEF DESCRIPTION OF DRAWINGS

[0067] Figure 1 is the flowchart of embodiment 1 of the application. DETAILED DESCRIPTION

[0068] The application will be further described in detail below in combination with the drawings and embodiments, but the application is not limited to the following embodiments.

[0069] Embodiment 1

[0070] The intelligent question answering method based on the traditional culture knowledge graph of the embodiment comprises the following steps (see Figure 1 ):

[0071] (1) Collecting traditional culture knowledge

[0072] The knowledge about traditional culture is searched from the national folk culture resource management system, and the data of names, introductions, types and nationalities in opera, folk song and traditional dance are extracted.

[0073] (2) Traditional culture data preprocessing

[0074] Delete, replace meaningless characters, garbled characters and invalid data, perform data cleaning, and remove unnecessary fields in each data.

[0075] (3) Constructing traditional culture data set

[0076] Traditional culture knowledge is processed into traditional culture data set Y, Y∈{a n ,b n ,c n ,d n ,e n ,f n}, where a n represents the identifier of each data, b n represents the name of each data, c n represents the introduction of each data, d n represents the type of each data, e n represents the nationality of the source of each data, f n is the detailed introduction of each data, and n represents the number of traditional culture knowledge data, n is at least 10000, and in this embodiment, n is 10000. The data set Y is divided into training set and test set according to the ratio of 7:3.

[0077] (4) Constructing name relationship dictionary

[0078] The name b n of each data in the data set Y is input into the name dictionary N, N∈{b1,b2,...,b n}, and the relationship type of the data set Y including introduction c, type d, nationality e, and detailed introduction f is input into the relationship dictionary R, R∈{c,d,e,f}.

[0079] (5) Constructing traditional culture knowledge graph

[0080] The data set Y includes the following categories:

[0081] Y={Op,Fs,Nd}

[0082] Where Op represents opera data, Fs represents folk song data, and Nd represents national dance data.

[0083] The opera data Op includes the following subcategories:

[0084] Op={Oc,Om,Or}

[0085] Wherein, Oc represents opera category data, Om represents opera character data, and Or represents opera classic play data.

[0086] Folk song data Fs includes the following subcategories:

[0087] Fs={Fc, Fi, Fp, Fo}

[0088] Wherein, Fc represents folk song category data, Fi represents folk song instrument data, Fp represents folk celebrity data, and Fo represents classical folk music data.

[0089] Dance data Nd includes the following subcategories:

[0090] Nd={Nt, Np}

[0091] Wherein, Nt represents traditional dance type data, and Np represents dance celebrity data.

[0092] The three major categories are the first level ontology of the knowledge graph, and the nine subcategories are the second level ontology of the knowledge graph. The data of the first level ontology is taken as the center, and the data of the second level ontology is arranged around the first level ontology, so as to obtain the traditional culture knowledge graph mode layer; the name b of the data set Y n is the first entity node, the introduction c, type d, nationality e, and detailed introduction f of the data set Y are relation nodes, and c n , d n , e n , and f n in the data set Y are second entity nodes. The first entity node, the relation node, and the second entity node are constructed into a triple output T according to the following formula:

[0093] T={b n , Ra, (c n , d n , e n , f n )},

[0094] Wherein, b n represents the first entity node in the triple, Ra represents the relation node of the triple, and (c n , d n , e n , f n ) represents the second entity node of the triple. The data set Y is converted into 40,000 triple data, the data layer of the knowledge graph is obtained, the triple data is stored in the graph database, and the visual traditional culture knowledge graph is constructed.

[0095] (6) Constructing a named entity recognition network

[0096] The named entity recognition network is composed of a word embedding layer, a bidirectional long short-term memory neural network, an attention mechanism layer, and a conditional random field (CRF) layer connected in sequence.

[0097] The word embedding layer of the embodiment is composed of an input layer, a hidden layer and an output layer in sequence.

[0098] The bidirectional long short-term memory neural network of the embodiment is composed of a forward long short-term memory neural network and a reverse long short-term memory neural network in parallel. t The reverse long short-term memory neural network is composed of an input layer, a hidden layer and an output layer in sequence.

[0099] The forgetting gate f is determined by the following formula t :

[0100] f t = σ (W f ·x t +V f ·h t-1 +b f )

[0101] Wherein, sigma represents a sigmoid activation function, · represents a dot product operation, W f , V f are weights, and b f represents a bias of a linear relationship.

[0102] The input gate i is determined by the following formula t :

[0103] i t = σ (W i ·x t +V i ·h t-1 +b i )

[0104] Wherein, W i , V i represent weights, and b i represents a bias.

[0105] The output gate o is determined by the following formula t :

[0106] o t = σ (W o ·x t +V c ·h t-1 +b o )

[0107] Wherein, W o , V c represent weights, and b o is a bias.

[0108] In this embodiment, the attention mechanism layer consists of three parallel fully connected layers connected in series with a dot product operation layer, a connection function layer, and another fully connected layer.

[0109] (7) Training the Named Entity Recognition Network

[0110] The cross-entropy loss function L(y,a) is determined by the following formula:

[0111] L(y,a)=y×lna+(1-y)×ln(1-a)

[0112] Where y is the true value, which takes the value of 0 or 1. In this embodiment, y takes the value of 0. a is the predicted value, which takes the value of (0,1). In this embodiment, a takes the value of 0.5.

[0113] The training set is input into the named entity recognition network, and the learning rate of the named entity recognition network r∈

[10] -5 10 -3 The training rounds are [10, 15], and in this embodiment, r is 10. -4 The training rounds are 12, the batch size for each round is 10, the optimizer is Adam, and the training iterations continue until the cross-entropy loss function L(y,a) converges.

[0114] (8) Testing the Named Entity Recognition Network

[0115] The test set was input into the named entity recognition network for testing.

[0116] (9) Named entity recognition

[0117] The user-input question text is fed into a pre-trained named entity recognition network for named entity recognition, and the output is the recognized traditional cultural name S, where S∈{s1,s2,...,s...} j}, s j This represents the j-th traditional cultural name, where j ranges from 1 to 10. In this example, j is 5. The data in the traditional cultural name S is compared one by one with the data in the name dictionary N, and the comparison results are input into a new list P.

[0118] P = compare(S, N)

[0119] Here, compare is the comparison function.

[0120] (10) Intent recognition

[0121] The user-input question text K is compared one by one with the relation types stored in the relation data dictionary R, ​​and the comparison results are entered into a new list Q:

[0122] Q = compare(K, Q)

[0123] where compare is a comparison function.

[0124] (11) Query answer

[0125] The recognition results of steps (9) and (10) are used to query the second entity node in the knowledge graph using the query language Cypher of the graph database, and the query result is the answer of the user.

[0126] (12) Show the answer result

[0127] The user sends a question in the chat window, and the script transmits it to the server asynchronously, and the server calls the object of the class to find the answer in the backend question and answer system, and the script receives the answer and displays it; The display of the answer result is abnormally handled, if the result is successfully queried in step (11), the system normally returns the answer to the user through the front end; If an error occurs in the recognition process of steps (9) and (10), the system prompts the user to input error, and the user re-enters; If the knowledge base cannot be connected, feedback the user server error, contact the administrator to repair.

[0128] Complete the intelligent question and answer method based on traditional cultural knowledge graph.

[0129] Embodiment 2

[0130] The intelligent question and answer method based on traditional cultural knowledge graph of the embodiment consists of the following steps:

[0131] (1) Collect traditional cultural knowledge

[0132] This step is the same as in embodiment 1.

[0133] (2) Traditional cultural data preprocessing

[0134] This step is the same as in embodiment 1.

[0135] (3) Construct traditional cultural data set

[0136] This step is the same as in embodiment 1.

[0137] (4) Construct name relationship dictionary

[0138] This step is the same as in embodiment 1.

[0139] (5) Construct traditional cultural knowledge graph

[0140] This step is the same as in embodiment 1.

[0141] (6) Construct named entity recognition network

[0142] This step is the same as in embodiment 1.

[0143] (7) Training the Named Entity Recognition Network

[0144] The cross-entropy loss function L(y,a) is determined by the following formula:

[0145] L(y,a)=y×lna+(1-y)×ln(1-a)

[0146] Where y is the true value, which takes the value of 0 or 1. In this embodiment, y takes the value of 1. a is the predicted value, which takes the value of 0.1 in this embodiment.

[0147] The training set is input into the named entity recognition network, and the learning rate of the named entity recognition network r∈

[10] -5 10 -3 In this embodiment, r is 10. -5 The number of training rounds is [10, 15]. In this embodiment, the number of training rounds is 10, the batch size of each training round is 10, the optimizer is Adam, and the training iterations are until the cross-entropy loss function L(y, a) converges.

[0148] (8) Testing the Named Entity Recognition Network

[0149] The steps are the same as in Example 1.

[0150] (9) Named entity recognition

[0151] The user-input question text is fed into a pre-trained named entity recognition network for named entity recognition, and the output is the recognized traditional cultural name S, where S∈{s1,s2,...,s...} j}, s j This represents the j-th traditional cultural name, where j ranges from 1 to 10. In this embodiment, j is 1. The data in the traditional cultural name S is compared one by one with the data in the name dictionary N, and the comparison result is input into a new list P.

[0152] P = compare(S, N)

[0153] Here, compare is the comparison function.

[0154] The other steps are the same as in Example 1, thus completing the intelligent question-answering method based on traditional cultural knowledge graph.

[0155] Example 3

[0156] The intelligent question-answering method based on traditional cultural knowledge graphs in this embodiment consists of the following steps:

[0157] (1) Collecting traditional cultural knowledge

[0158] The steps are the same as in Example 1.

[0159] (2) Traditional culture data preprocessing

[0160] This step is the same as example 1.

[0161] (3) Constructing a traditional culture data set

[0162] This step is the same as example 1.

[0163] (4) Constructing a name relationship dictionary

[0164] This step is the same as example 1.

[0165] (5) Constructing a traditional culture knowledge graph

[0166] This step is the same as example 1.

[0167] (6) Constructing a named entity recognition network

[0168] This step is the same as example 1.

[0169] (7) Training a named entity recognition network

[0170] The cross-entropy loss function L(y, a) is determined as follows:

[0171] L(y, a) = y * ln a + (1-y) * ln(1-a)

[0172] Where y is the true value, y takes the value 0 or 1, y in this embodiment takes the value 0, a is the predicted value, a ∈ (0, 1), a in this embodiment takes the value 0.9.

[0173] The training set is input into the named entity recognition network, the learning rate r of the named entity recognition network ∈ [10 -5 ,10 -3 ], r in this embodiment takes the value 10 -3 , the number of training rounds is [10, 15], the number of training rounds in this embodiment is 15, the batch size of each round of training is 10, the optimizer is Adam, and the training is iterated until the cross-entropy loss function L(y, a) converges

[0174] (8) Testing the named entity recognition network

[0175] The test set is input into the named entity recognition network for testing.

[0176] (9) Named entity recognition

[0177] The user input question text is input into the trained named entity recognition network for named entity recognition, and the recognized traditional culture name S is output, S ∈ {s1, s2,..., s j} s jSj represents the jth traditional culture name, j is 1-10, j is 10 in this embodiment, the data in the traditional culture name S is compared with the data in the name dictionary N one by one, and the comparison result is input into a new list P:

[0178] P = compare (S, N)

[0179] Wherein, compare is a comparison function.

[0180] The other steps are the same as in example 1, and the intelligent question answering method based on traditional culture knowledge graph is completed.

[0181] Example 4

[0182] In the above examples 1-3, the intelligent question answering method based on traditional culture knowledge graph of this embodiment consists of the following steps:

[0183] (1) Collecting traditional culture knowledge

[0184] This step is the same as example 1.

[0185] (2) Traditional culture data preprocessing

[0186] This step is the same as example 1.

[0187] (3) Constructing traditional culture dataset

[0188] The traditional culture knowledge is processed into a traditional culture dataset Y, Y ∈ {a n ,b n ,c n ,d n ,e n ,f n}, wherein a n represents the identifier of each data, b n represents the name of each data, c n represents the introduction of each data, d n represents the type of each data, e n represents the nationality of each data source, f n is the detailed introduction of each data, n represents each traditional culture knowledge data, n is at least 10000, n is 20000 in this embodiment, and the dataset Y is divided into training set and test set according to the proportion of 7:3.

[0189] The other steps are the same as in the corresponding example, and the intelligent question answering method based on traditional culture knowledge graph is completed.

Claims

1. An intelligent question-answering method based on a traditional cultural knowledge graph, characterized in that... It consists of the following steps: (1) Collecting traditional cultural knowledge Search for knowledge about traditional culture in the Ethnic and Folk Culture Resource Management System, and extract the names, introductions, types, and ethnic data of operas, folk songs, and traditional dances; (2) Preprocessing of traditional cultural data Delete and replace meaningless characters, garbled text, and invalid data to perform data cleaning and remove unnecessary fields from each data entry; (3) Constructing a traditional culture dataset Traditional cultural knowledge is processed into a traditional cultural dataset Y, where Y∈{a n ,b n ,c n ,d n ,e n ,f n }, where a n The identifier representing each piece of data, b n c represents the name of each data entry. n d represents a brief description of each data entry. n Indicates the type of each data item, e n f represents the ethnicity from which each data point originates. n This is a detailed introduction to each data point, where n represents each piece of traditional cultural knowledge data. The value of n is at least 10000. The dataset Y is divided into training set and test set in a 7:3 ratio. (4) Construct a name relation dictionary Name each data item in dataset Y (b) n Input the name dictionary N, where N∈{b1,b2,...,b n }, take the relation types in dataset Y, including introduction c, type d, ethnicity e, and detailed description f, and input them into the relation dictionary R, ​​R∈{c,d,e,f}; (5) Constructing a knowledge graph of traditional culture Dataset Y includes the following major categories: Y = {Op, Fs, Nd} Where Op represents opera data, Fs represents folk song data, and Nd represents ethnic dance data; Opera data Op includes the following subcategories: Op = {Oc, Om, Or} Where Oc represents data on opera categories, Om represents data on opera characters, and Or represents data on classic opera plays; Folk song data Fs includes the following subcategories: Fs = {Fc, Fi, Fp, Fo} Where Fc represents folk song category data, Fi represents folk song instrument data, Fp represents folk song celebrity data, and Fo represents classical folk music data; Dance data Nd includes the following subcategories: Nd = {Nt, Np} Wherein, Nt represents data on traditional dance styles, and Np represents data on famous dancers; The dataset consists of three main categories representing the first-level ontology classes of the knowledge graph, and nine subcategories representing the second-level ontology classes. Centered on the data of the first-level ontology classes, with the data of the second-level ontology classes surrounding them, a traditional culture knowledge graph pattern layer is obtained; the dataset Y is named b. n For the first entity node, the dataset Y contains a brief description (c), type (d), ethnicity (e), and detailed information (f). For the relation node, c represents the data in dataset Y. n d n e n f n For the second entity node, construct the output T of the triplet by combining the first entity node, the relation node, and the second entity node as follows: T={b n ,Ra,(c n ,d n ,e n ,f n )} Among them, b n Ra represents the first entity node in the triple, and Ra represents the relation node of the triple. n d n e n f n ) represents the second entity node of the triple. The dataset Y is converted into 40,000 triple data to obtain the data layer of the knowledge graph. The triple data is stored in the graph database to construct a visualized traditional culture knowledge graph. (6) Constructing a Named Entity Recognition Network The named entity recognition network consists of a word embedding layer, a bidirectional long short-term memory neural network, an attention mechanism layer, and a conditional random field (CRF) layer connected in series. (7) Training the Named Entity Recognition Network The cross-entropy loss function L(y,a) is determined by the following formula: L(y,a)=y×lna+(1-y)×ln(1-a) Where y is the true value, which takes the value 0 or 1, and a is the predicted value, where a∈(0,1); The training set is input into the named entity recognition network, and the learning rate of the named entity recognition network r∈[10] -5 10 -3 The training rounds are [10, 15], the batch size for each round is 10, the optimizer is Adam, and the training iterations are until the cross-entropy loss function L(y, a) converges; (8) Testing the Named Entity Recognition Network The test set was input into the named entity recognition network for testing; (9) Named entity recognition The user-input question text is fed into a pre-trained named entity recognition network for named entity recognition, and the output is the recognized traditional cultural name S, where S∈{s1,s2,...,s...} j }, s j This represents the j-th traditional cultural name, where j ranges from 1 to 10. The data in the traditional cultural name S is compared one by one with the data in the name dictionary N, and the comparison results are input into a new list P. P = compare(S, N) Where compare is the comparison function; (10) Intent recognition The user-input question text K is compared one by one with the relation types stored in the relation data dictionary R, ​​and the comparison results are entered into a new list Q: Q = compare(K, Q) Where compare is the comparison function; (11) Search for the answer The identification results from steps (9) and (10) are used to query the second entity node in the knowledge graph using the Cypher query language of graph databases. The query result is the user's answer. (12) Display the Q&A results The user sends a question in the chat window, and the script transmits it to the server asynchronously. The server calls an object of the class to find the answer in the backend question and answer system. The script receives the answer and displays it. The display of the question and answer results is handled in an exception. If the result is successfully found in step (11), the system returns the answer to the user through the front end. If the system makes a mistake in the recognition process in steps (9) and (10), the system prompts the user that the input is wrong and the user re-enters the information. If the user cannot connect to the knowledge base, the system reports that the server is faulty and the user is contacted to fix it.

2. The intelligent question-answering method based on traditional cultural knowledge graph according to claim 1, characterized in that: In step (6), the named entity recognition network is constructed by connecting the input layer, hidden layer, and output layer in sequence.

3. The intelligent question-answering method based on traditional cultural knowledge graph according to claim 1, characterized in that: In step (6), the named entity recognition network is constructed by connecting a forward long short-term memory neural network and a backward long short-term memory neural network in parallel. The forward long short-term memory neural network consists of a forget gate f, an input gate i, and an output gate o. t They are connected in series; the reverse long short-term structured memory neural network has the same structure as the forward long short-term structured memory neural network. Determine the forgetting gate f using the following formula t : f t =σ(W f ·x t +V f ·h t-1 +b f ) Where σ represents the sigmoid activation function, · represents the dot product operation, and W f V f These are the weights, b f Indicates the bias of a linear relationship; The input gate i is determined by the following formula. t : i t =σ(W i ·x t +V i ·h t-1 +b i ) Among them, W i V i These represent the weights, b and b respectively. i Indicates bias; Determine the output gate o using the following formula t : the t =σ(W o ·x t +V c ·h t-1 +b o ) Among them W o V c These represent the weights, b and b respectively. o For bias.

4. The intelligent question-answering method based on traditional cultural knowledge graph according to claim 1, characterized in that: In step (6) of constructing the named entity recognition network, the attention mechanism layer is composed of three parallel fully connected layers and a dot product operation layer, a connection function layer, and a fully connected layer connected in series.

Citation Information

Patent Citations

  • Query and visualization system construction method based on minority culture knowledge graph

    CN111143574A

  • Relation detection method for question-answering system based on a knowledge graph

    CN111400455A