A method and system for constructing a knowledge graph of steel materials
By constructing a knowledge graph of steel materials science and using IDCNN-CRF and TransE models for entity extraction and clustering, the problems of scattered information and weak correlation in the field of steel materials were solved, and the simple and clear expression and efficient utilization of knowledge were realized.
Patent Information
- Application Number
- CN202210921904.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-08-02
AI Technical Summary
The lack of scientific and effective knowledge expression and structural presentation methods in the field of steel materials has resulted in fragmented information with weak connections, making it difficult to achieve simple and clear knowledge utilization.
To construct a knowledge graph for steel materials science, we extract core concept words from textual information, use the IDCNN-CRF model to extract entities and attributes, combine the TransE model to score and fuse entity vectors, cluster to determine whether to update core concept words, and finally construct a fused knowledge graph.
It enables a simple and clear expression of knowledge in the field of steel materials, improves knowledge utilization, automatically identifies and updates core concept terms, and enhances the relevance and efficiency of information utilization.
Smart Images

Figure CN115238040B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of knowledge graph construction, in particular to a steel material science knowledge graph construction method and system. BACKGROUND
[0002] At present, with the continuous expansion of the scale of steel enterprises and the gradual increase of various applications, there is no scientific and effective knowledge expression and structure presentation method in the field of steel materials. The application of steel material information is specific, heterogeneous and scattered, and they are scattered in different data sources, so it is difficult for users to find the required information. Generally speaking, structured knowledge mostly exists in databases, semi-structured and unstructured knowledge often exists in the form of paragraphs or articles in literature manuals and other materials, and the correlation between these knowledge is weak, and they often exist independently. It is still difficult to obtain simple and clear expression knowledge. SUMMARY
[0003] The purpose of the present application is to provide a steel material science knowledge graph construction method and system, which realizes simple and clear expression of knowledge data in the field of steel materials, and helps to improve the utilization rate of knowledge in the field of steel materials.
[0004] To achieve the above purpose, the present application provides the following scheme:
[0005] A steel material science knowledge graph construction method, the steel material science knowledge graph construction method comprising the following steps:
[0006] Obtain text information of steel material science, select a plurality of core concept words from each text information, and construct a core concept layer;
[0007] According to the core concept layer, obtain the domain data related to each core concept word, and obtain a domain database; the domain database includes structured domain data and unstructured domain data;
[0008] The IDCNN-CRF model is used for entity extraction and attribute extraction of the unstructured domain data, and the structured domain data is obtained;
[0009] According to the structured domain data and the word relationship of each domain data, an initial knowledge graph is constructed; the initial knowledge graph includes a plurality of entity triples, and the entity triples include a head entity, a tail entity and a head-tail relationship;
[0010] Each entity triple is converted into an entity vector by using a TransE model, the similarity scores between each entity vector are calculated, and two entity vectors with a similarity score greater than a preset threshold are fused to obtain a fused knowledge graph;
[0011] Clustering the entities in the fusion knowledge graph, judging whether there is a new core concept word, obtaining a first judgment result;
[0012] If the first judgment result is yes, the new core concept word is updated to the core concept layer, and the step of "obtaining domain data related to each core concept word according to the core concept layer, obtaining a domain database" is jumped to;
[0013] If the first judgment result is no, the fusion knowledge graph is taken as a final steel material science knowledge graph.
[0014] Optionally, the text information of steel material science is obtained, a plurality of core concept words are selected from each text information, and a core concept layer is constructed, specifically including:
[0015] A plurality of text information of steel material science is obtained.
[0016] Each text information is subjected to word segmentation processing, a plurality of words, and the part of speech of each word, the text information to which each word belongs, and the position of each word in the text information are obtained.
[0017] Each word is de-duplicated, and each word is filtered according to the part of speech of each word, and the words with the part of speech of noun, organization, special noun, verb and gerund are reserved as a reserved word set.
[0018] The TF-IDF scores of each word in the reserved word set are calculated, and each word is sorted in descending order according to the TF-IDF scores.
[0019] The top N words are selected as core keywords.
[0020] According to the position of each core keyword in the text information, a plurality of words recorded before and after the core keyword are selected as core associated words, and the core keyword and the core associated word together constitute a core concept word.
[0021] According to the inter-word relationship between each core concept word, a core concept layer is constructed; the inter-word relationship includes upper and lower relationship, synonymous relationship, attribute relationship, concept instance relationship and general relationship.
[0022] Optionally, the TF-IDF score of each word in the reserved word set is calculated according to the following formula:
[0023]
[0024] Wherein, F mrepresents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, i represents the number of text information.
[0025] Optionally, before the entity extraction and attribute extraction of the unstructured field data using the IDCNN-CRF model, the steel material science knowledge graph construction method further comprises:
[0026] For any unstructured field data, the field data is processed by a word segmentation algorithm, and a sentence vector of the field data is calculated according to the word vector of each word segmentation;
[0027] According to the sentence vector of each unstructured field data, the k-means clustering algorithm is used to cluster each unstructured field data to obtain a plurality of clustering piles;
[0028] An equal proportion of unstructured field data is selected from each clustering pile as a manual annotation set; the manual annotation set includes a plurality of unstructured field data and an annotation label of each character of the unstructured field data; the annotation label includes: entity, attribute, attribute value and irrelevant value;
[0029] The manual annotation set is divided into a training set, a validation set and a test set according to a predetermined proportion;
[0030] The IDCNN-CRF model is trained using the training set, the unstructured field data is used as input, and the annotation label of each character of the unstructured field data is used as target output to obtain an initial IDCNN-CRF model;
[0031] The hyperparameters of the initial IDCNN-CRF model are adjusted using the validation set to obtain an adjusted IDCNN-CRF model;
[0032] The test set is input into the adjusted IDCNN-CRF model, and the evaluation index is calculated according to the annotation label of each character of the unstructured field data predicted by the adjusted IDCNN-CRF model and the annotation label of each character of the unstructured field data in the test set;
[0033] If the evaluation index is higher than a predetermined index threshold, the entity extraction and attribute extraction of the unstructured field data are performed using the adjusted IDCNN-CRF to obtain structured field data;
[0034] If the evaluation index is lower than the preset index threshold, the artificial annotation set is re-annotated, and the step of "taking the unstructured field data as input, taking the annotation label of each word of the unstructured field data as target output, training the IDCNN-CRF model by using the training set, and obtaining the initial IDCNN-CRF model" is jumped.
[0035] Optionally, the loss function of the TransE model is as follows:
[0036]
[0037] Wherein, S represents a triple set of the initial knowledge graph; (E h ,E l ,E t ) is a triple in the triple set, E h is the head entity in the triple, E l is the head-tail relationship in the triple, E t is the tail entity in the triple, (E h` ,E l ,E t` ) is a negative example triple obtained by randomly replacing the head entity and the tail entity of the triple, γ represents the allowable error of the correct triple and the negative example triple, ||2 represents the L2 norm, [] + represents the hinge loss function, and takes a non-negative result.
[0038] Optionally, the similarity score between each entity vector and each other entity vector is calculated according to the following formula:
[0039]
[0040] Wherein, EA and EB represent different entity vectors respectively, and n is the dimension of the entity vector.
[0041] Corresponding to the aforementioned steel material science knowledge graph construction method, the application further provides a steel material science knowledge graph construction system, the steel material science knowledge graph construction system comprising:
[0042] A core concept layer determination module is configured to obtain text information of steel material science, select a plurality of core concept words from each text information of steel material science, and determine a core concept layer.
[0043] A field database construction module is configured to obtain field data related to each core concept word according to the core concept layer, and obtain a field database; the field database comprises structured field data and unstructured field data.
[0044] a structured data extraction module configured to perform entity extraction and attribute extraction on the unstructured domain data by using an IDCNN-CRF model to obtain structured domain data;
[0045] an initial knowledge graph construction module configured to construct an initial knowledge graph according to the structured domain data and the inter-word relationships between the domain data; the initial knowledge graph includes a plurality of entity triples, and each entity triple includes a head entity, a tail entity, and a head-tail relationship;
[0046] an entity vector fusion module configured to convert each entity triple into an entity vector by using a TransE model, calculate similarity scores between each pair of entity vectors, and fuse two entity vectors with similarity scores greater than a preset threshold to obtain a fused knowledge graph;
[0047] a domain data clustering module configured to cluster entities in the fused knowledge graph, determine whether there is a new core concept word, and obtain a first determination result; if the first determination result is yes, a core concept layer updating module is invoked; if the first determination result is no, the fused knowledge graph is taken as a final knowledge graph of steel material science;
[0048] the core concept layer updating module is configured to update the new core concept word into the core concept layer and re-invoke the domain database construction module.
[0049] Optionally, the core concept layer determination module includes:
[0050] a text information acquisition unit configured to acquire a plurality of pieces of text information of steel material science;
[0051] a word segmentation processing unit configured to perform word segmentation processing on each piece of text information to obtain a plurality of words, and the part of speech of each word, the text information to which each word belongs, and the position of each word in the text information;
[0052] a reserved word set determination unit configured to remove duplicates from each word, and filter each word according to the part of speech of each word, and reserve words with the part of speech of noun, organization, special noun, verb, and gerund as a reserved word set;
[0053] a TF-IDF score calculation unit configured to calculate the TF-IDF score of each word in the reserved word set, and sort each word in descending order according to the TF-IDF score;
[0054] a core keyword determination unit configured to select the top N words as core keywords;
[0055] The core association word determination unit is configured to select, from several words recorded before and after each core keyword in the text information, a word with a frequency greater than that of other words as a core association word according to the position of the core keyword in the text information; and the core keyword and the core association word jointly constitute a core concept word.
[0056] The core concept layer construction unit is configured to construct a core concept layer according to the inter-word relationship between each core concept word; and the inter-word relationship includes an upper-lower relationship, a synonymous relationship, an attribute relationship, a concept instance relationship and a general relationship.
[0057] Optionally, the TF-IDF score of each word in the reserved word set is calculated according to the following formula:
[0058]
[0059] wherein F m represents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, and i represents the number of text information.
[0060] Optionally, the similarity score between each pair of entity vectors is calculated according to the following formula:
[0061]
[0062] wherein EA and EB represent different entity vectors respectively, and n is the dimension of the entity vector.
[0063] According to the specific embodiments of the present application, the following technical effects are provided:
[0064] This invention provides a method and system for constructing a knowledge graph for steel materials science. The method includes: acquiring textual information about steel materials science; selecting several core concept words from the textual information to construct a core concept layer; acquiring domain data related to each core concept word based on the core concept layer to obtain a domain database; using the IDCNN-CRF model to extract entities and attributes from the unstructured domain data to obtain structured domain data; constructing an initial knowledge graph based on the structured domain data and the word relationships between them; using the TransE model to convert each entity triple into an entity vector, calculating the similarity score between each pair of entity vectors, and fusing two entity vectors with similarity scores greater than a preset threshold to obtain a fused knowledge graph; clustering the entities in the fused knowledge graph to determine whether there are new core concept words, obtaining a first judgment result; if the first judgment result is yes, then the new concept word is updated to the core concept layer, and the domain database is redefined; otherwise, the fused knowledge graph is used as the final knowledge graph for steel materials science. The method and system for constructing a knowledge graph in steel materials science provided by this invention automatically identifies core concept words in the field from a large amount of textual information in steel materials science, automatically acquires relevant domain data based on the core concept words, obtains entity vectors in the initial knowledge graph using the TransE model, and then automatically performs entity vector fusion and domain data clustering. Furthermore, it can update the core concept layer based on the clustering results and complete the update of the knowledge graph. The final constructed knowledge graph in steel materials science can express knowledge data in the field of steel materials in a simple and clear way, which helps to improve the utilization rate of knowledge in the field of steel materials science. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 This is a flowchart of a method for constructing a knowledge graph of steel materials science provided in Embodiment 1 of the present invention;
[0067] Figure 2 This is a schematic diagram of the core concept layer in the knowledge graph construction method provided in Embodiment 1 of the present invention;
[0068] Figure 3 This is a schematic diagram of a knowledge graph construction system for steel materials science provided in Embodiment 2 of the present invention. Detailed Implementation
[0069] With reference to the accompanying drawings: clear and complete description of the technical solutions in the embodiments of the present application will be described below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the scope of the present application.
[0070] The purpose of the present application is to provide a steel material knowledge graph construction method and system, which improves the utilization rate of knowledge in the field of steel materials.
[0071] In order to make the above-mentioned purposes, features and advantages of the present application more apparent and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0072] Embodiment 1:
[0073] The present embodiment provides a steel material knowledge graph construction method, as shown in the flow chart, the steel material knowledge graph construction method comprises the following steps: Figure 1
[0074] S1, obtaining text information of steel material science, selecting a plurality of core concept words from each text information, and constructing a core concept layer; specifically including:
[0075] S11, obtaining a plurality of text information of steel material science; the text information can be an article abstract from Zhiwu or other academic websites about steel field review and encyclopedia data related to steel field on the Internet. The obtained information is uniformly converted into TXT format and saved, and the processed TXT text information is saved in a specified position.
[0076] In this embodiment, 34 review articles are collected in Zhiwu by searching with "steel material" as the keyword, and 38 Baidu encyclopedia data about steel brand are collected on the Internet, totaling 72 text information.
[0077] S12, performing word segmentation processing on each text information to obtain a plurality of words, and the part of speech of each word, the text information to which each word belongs and the position of each word in the text information; the result of word segmentation processing is a string with part of speech annotation, the string is parsed and stored in a structure, the structure includes <word, file name where the word is located, word length, part of speech, position information>; then a stop word table is used to remove as many words as possible that do not conform to the concept in the field to finally obtain the processed ontology data set S.
[0078] The 72 text information is labeled as 1-72 in this embodiment, and each text information is segmented and tagged by using hanlp. The number of words contained in the stop word table used is 1893, and the final ontology data set S contains 6489 structures, such as <organization feature, 2, 4, n, 39>, where 2 represents that the word “organization feature” is located in the 2nd of the 72 documents, 4 represents the word length, n represents the noun, and 39 represents that the word is located in the 39th in the text information.
[0079] S13, each of the words is de-duplicated, and each of the words is filtered according to the part of speech of each of the words, and the words with the part of speech of noun, organization, special noun, verb and gerund are retained as the reserved word set; the ontology data set S is screened by part of speech, and the words with the part of speech of noun (n), organization (nt), other proper name (nz), verb (v) and gerund (vn) are retained, the total number is N, de-duplication obtains m candidate keyword sets D, D = [t1, t2, …, tm], and the number of words in each candidate keyword set D is m. m
[0080] In this embodiment, the final total number is 3280, and de-duplication obtains 1370.
[0081] S14, the TF-IDF score of each word in the reserved word set is calculated, and each word is sorted in descending order according to the TF-IDF score; in this embodiment, the TF-IDF score of each word in the reserved word set is calculated according to the following formula:
[0082]
[0083] Wherein, F m represents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, and i represents the number of text information.
[0084] S15, the top N words are selected as core keywords; since the IDF (inverse document frequency) of some rare words is relatively high, some rare characters need to be removed manually, and finally the top N words are obtained as core keywords.
[0085] In this embodiment, topN is selected as 20, and the results obtained are: steel grade, type, chemical composition, process parameter, mechanical property, carbon element, silicon element, tensile strength, manganese element, yield strength, phosphorus element, elongation, reduction of area, sulfur element, use, standard, macroscopic performance, delivery state, product specification, and other name. It is determined that the steel grade is the subject word.
[0086] S16, according to the position of each core keyword in the text information, select the word with the frequency greater than the frequency of other words as the core associated word from the several words recorded before and after the core keyword; the core keyword and the core associated word jointly constitute the core concept word; when selecting the associated word of each core keyword, the core keyword exists in multiple documents, and the first two words with the highest frequency are selected as the core associated word from the words before and after the core keyword; in this embodiment, the distance between words is 3, and the core associated words obtained include: nickel element, chromium element, classification basis, production equipment, high-quality steel, ordinary steel, carbon steel, alloy steel, structural steel, tool steel, special performance steel, stainless steel, free-cutting steel, and martensitic steel.
[0087] S17, according to the word relationship between each core concept word, a core concept layer as shown in Figure 2 is constructed; the word relationship includes: upper and lower relationship, synonymous relationship, attribute relationship, whole and part relationship, concept instance relationship and general relationship.
[0088] The upper and lower relationship mainly determines the parent concept and the child concept according to the range; the synonymous relationship mainly refers to the same or similar expression of the concept, which is mainly extracted from the different literal expressions of the same concept or ontology; the attribute relationship is the relationship between the entity and its characteristics. The whole and part relationship is a part of the whole and forms an indispensable part; the concept and instance relationship mainly refers to the relationship between the upper concept and the lower specific instance; but not all relationships can be classified into these 5 relationships, and other relationships that cannot be clearly classified are collectively referred to as general relationships in this embodiment.
[0089] The word relationship between each core concept word in this embodiment is shown in Table 1:
[0090] Table 1
[0091]
[0092]
[0093] S2, according to the core concept layer, obtain the domain data related to each core concept word, and obtain a domain database; in this embodiment, the domain data related to each core concept word in the core concept layer obtained in step S1 is obtained from the Internet, and the domain data is classified according to the core concept word to construct a domain database; the domain database includes structured domain data and unstructured domain data.
[0094] S3, entity extraction and attribute extraction are performed on the unstructured field data by using the IDCNN-CRF model to obtain structured field data. The IDCNN-CRF model applies IDCNN as an encoder to generate the probability of each label for each word of a sentence, and then uses a CRF model to add a constraint on the label transition probability, so as to obtain an optimal prediction sequence through the relationship between adjacent labels to label the entity of the sentence and extract the entity and attribute in the sentence to obtain structured data.
[0095] S4, an initial knowledge graph is constructed according to the structured field data and the inter-word relationship of each field data; the initial knowledge graph includes a plurality of entity triples, and the entity triple includes a head entity, a tail entity and a head-tail relationship; in this embodiment, the size of the initial knowledge graph established is shown in Table 2:
[0096] Table 2
[0097] Total number of subject words Total number of nodes Total number of relationships Total number of ontology classes Total number of relationship classes 16452 73942 318714 34 4
[0098] In the table, the total number of subject words is the number of field data obtained according to the subject words; in this embodiment, the subject words are steel grades; the total number of nodes is the total number of head entities and tail entities, which is also the total number of field data; the total number of relationships refers to the number of relationships between nodes, and each entity has at least one relationship.
[0099] S5, each entity triple is converted into an entity vector by using a TransE model;
[0100] In this embodiment, the knowledge representation model TransE is used to vectorize the representation of entities and relationships on the basis of preserving semantic information, and the loss function of the TransE model is as follows:
[0101]
[0102] wherein S represents a triple set of the initial knowledge graph; (E h ,E l ,E t ) is a triple in the triple set, E h is a head entity in the triple, E l is a head-tail relationship in the triple, E t is a tail entity in the triple, (E h` ,E l ,E t` ) is a negative example triple obtained by randomly replacing the head entity and the tail entity of the triple, γ represents the allowable error of the correct triple and the negative example triple, ||2 represents the L2 norm, and [] + represents a hinge loss function, and takes a non-negative result.
[0103] S6, calculate the similarity scores between each pair of entity vectors, and fuse two entity vectors with similarity scores greater than a preset threshold to obtain a fused knowledge graph;
[0104] In this embodiment, the similarity scores between each pair of entity vectors are calculated according to the following formula:
[0105]
[0106] wherein EA and EB represent different entity vectors respectively, and n is the dimension of the entity vector.
[0107] In this embodiment, many steel grades have different grade names due to various standards, and this method can effectively fuse the same grades, such as Q275D and U12759 representing the same steel, U12759 being executed for the Chinese ISC standard, and the similarity score between the two entities being 0.965. The threshold p is 0.9, and finally the two can be fused. The size of the fused knowledge graph obtained through this step is shown in Table 3:
[0108] Table 3
[0109] Total number of subject words (model numbers) Total number of nodes Total number of relationships 11881 66849 247784
[0110] S7, clustering the entities in the fused knowledge graph.
[0111] S8, determining whether there is a new core concept word after clustering to obtain a first determination result; if the first determination result is yes, performing step S9, otherwise performing step S10.
[0112] In this embodiment, the clustering centers are selected according to the elbow method, and a new category appears after clustering, i.e., a new core concept word appears, such as standard description, forged steel, cast steel, and professional steel.
[0113] S9, updating the new core concept word to the core concept layer, and jumping to step S2 "obtaining domain data related to each core concept word according to the core concept layer to obtain a domain database".
[0114] In this embodiment, the new category words such as standard description, forged steel, cast steel, and professional steel appearing after S7 clustering are confirmed by manual review and added to the core concept layer as core concept words. The number of core concept words in the core concept layer changes from 34 to 38, and the process jumps back to step S2. Steps S2-S8 are repeated, and the size of the final knowledge graph is shown in Table 4:
[0115] Table 4
[0116] Total number of subject words (model numbers) Total number of nodes Total number of relationships Total number of ontology classes Total number of relationship classes 11881 66849 247784 38 4
[0117] S10, taking the fusion knowledge graph as a final steel material science knowledge graph.
[0118] In some embodiments, before the step S3 of performing entity extraction and attribute extraction on the unstructured field data by using the IDCNN-CRF model, the steel material science knowledge graph construction method further comprises steps A1-A9 of training and adjusting the IDCNN-CRF:
[0119] A1, for any unstructured field data, performing word segmentation processing on the field data by using a word segmentation algorithm, and calculating a sentence vector of the field data according to a word vector of each word segmentation;
[0120] In this embodiment, the Chinese word segmentation method provided by hanlp is used to perform word segmentation processing on the unstructured field data, and the stop word table mentioned in the foregoing is used to remove the stop words therein. The word2vec is used to obtain a 128-dimensional word vector, all the words contained in a field data are added, and then the sentence vector is normalized to obtain a final sentence vector, which also has a dimension of 128.
[0121] A2, according to the sentence vector of each unstructured field data, performing clustering on each unstructured field data by using a k-means clustering algorithm to obtain a plurality of clustering piles; in this embodiment, the K-means method is used to perform clustering analysis on the Euclidean distance between the sentence vectors, and the number of clustering centers is obtained by using the elbow method, and the final number of clustering centers is 15.
[0122] A3, selecting equal proportions of unstructured field data in each clustering pile as a manual annotation set; the manual annotation set comprises a plurality of unstructured field data and an annotation label of each character of each unstructured field data; the annotation label comprises: entity, attribute, attribute value and irrelevant value; in this embodiment, 1 / 8 of the sentences in each category pile are taken to obtain the manual annotation set. In this embodiment, a total of 8731 unstructured field data are collected, and 1100 field data in the final manual annotation set are obtained.
[0123] Manually annotate the domain data in the manually annotated set to obtain annotated samples. For example, if the domain data is the text "Y12 steel belongs to sulfur-based free-cutting steel, with a tensile strength of 500 MPa in the delivery state", the manually annotated result would be "Y / B-G1 / I-G2 / IG steel / O material / O belongs to / O sulfur / BG system / BG free / BG cut / BG cutting / BG steel / BG, / O delivery / O goods / O state / O tensile strength / IP strength / IP degree / I-P5 / B-N0 / I-N0 / I-NM / I-Np / I-Na / IN". G, P, and N represent entities, attributes, and attribute values, respectively, and O represents other classes that are not of interest.
[0124] A4. Divide the manually labeled set into a training set, a validation set, and a test set according to a preset ratio; split the labeled samples into the training set, the validation set, and the test set in a ratio of 8:1:1;
[0125] A5. Train the IDCNN-CRF model using the training set, taking unstructured domain data as input and the labeled tags of each character in the unstructured domain data as the target output, to obtain the initial IDCNN-CRF model;
[0126] To train the IDCNN-CRF model, for a sentence sequence X = (x1, x2, ..., x...), ... n For the predicted label sequence Y = (y1, y2, ..., y...), n For example, its fractional function is:
[0127]
[0128] Where s(X,Y) represents the sequence of sentences X=(x1,x2,...,x...). n The predicted label sequence is Y = (y1, y2, ..., y3). n The score is P, where P is the output score matrix of IDCNN. Indicates the xth i The predicted label for each word is y. i The score, A is the transition score matrix, For label y i Transfer to label y i+1 The score.
[0129] The probability of generating the predicted sequence Y is:
[0130]
[0131] The model's loss function is:
[0132]
[0133] where p(Y|X) is the probability of correctly predicting the label sequence, Y is the predicted label sequence of the sentence sequence, X Y is all possible predicted label sequences of the sentence sequence.
[0134] A6, adjust the hyperparameters of the initial IDCNN-CRF model using the validation set to obtain an adjusted IDCNN-CRF model; in this embodiment, the hyperparameters of the model are set as follows: the maximum length of the longest sentence max_len is 100, the word vector encoding length embedding_dim is 128, drop_rate takes a value of 0.5, drop_rate is a parameter in the network, and 50% of the neurons are randomly shielded during network training to prevent overfitting.
[0135] A7, input the test set into the adjusted IDCNN-CRF model, and calculate the evaluation index according to the annotation label of each word predicted and output by the adjusted IDCNN-CRF model and the annotation label of each word in the unstructured domain data in the test set;
[0136] After adjusting the hyperparameters of the model using the validation set, the accuracy, recall, and F1 value of the evaluation index are obtained, and the formulas are as follows:
[0137]
[0138]
[0139]
[0140] In the formula, R(i) represents the set of alternative grades predicted by the model for steel grade i; and T(i) represents the set of alternative grades of steel grade i in the test set.
[0141] If the index does not reach the threshold value, manual annotation is continued in the category corpus obtained according to the above clustering analysis, the model is retrained until the threshold value is reached; when the threshold value is reached, the model can be used to predict unannotated unstructured domain data, extract entities and attributes in the sentences, and finally obtain structured domain data;
[0142] The evaluation index finally obtained in the test set in this embodiment is shown in Table 5:
[0143] Table 5
[0144] Moudle Accuracy P Recall R F1 value IDCNN_CRF 84.90% 80.55% 82.62%
[0145] The model's accuracy (P), recall (R), and F1 score on the test set all exceeded the threshold of 80%, so no further data labeling was required. The final IDCNN-CRF model was then used for entity extraction and attribute extraction.
[0146] A8. If the evaluation index is higher than the preset index threshold, then the adjusted IDCNN-CRF is used to extract entities and attributes from the unstructured domain data to obtain structured domain data.
[0147] A9. If the evaluation index is lower than the preset index threshold, the manually labeled set is re-labeled, and the process jumps to step A5: "Use the training set to train the IDCNN-CRF model, take unstructured domain data as input, and take the label of each word in the unstructured domain data as the target output to obtain the initial IDCNN-CRF model."
[0148] Example 2:
[0149] like Figure 3 The structural diagram shown corresponds to the method for constructing a knowledge graph of steel materials science provided in Example 1. This example provides a knowledge graph construction system for steel materials science, which includes:
[0150] Core concept layer determination module 1 is used to obtain textual information of steel materials science, select several core concept words from the various textual information of steel materials science, and determine the core concept layer;
[0151] Domain database construction module 2 is used to obtain domain data related to each core concept word based on the core concept layer, and obtain a domain database; the domain database includes structured domain data and unstructured domain data;
[0152] The structured data extraction module 3 is used to extract entities and attributes from the unstructured domain data using the IDCNN-CRF model to obtain structured domain data.
[0153] The initial knowledge graph construction module 4 is used to construct an initial knowledge graph based on structured domain data and the word relationships between domain data; the initial knowledge graph includes several entity triples, and the entity triples include head entities, tail entities, and head-tail relationships;
[0154] Entity vector fusion module 5 is used to convert each entity triple into an entity vector using the TransE model, calculate the similarity score between each pair of entity vectors, and fuse two entity vectors with similarity scores greater than a preset threshold to obtain a fused knowledge graph.
[0155] The field data clustering module 6 is configured to cluster the entities in the fusion knowledge graph, determine whether there is a new core concept word, and obtain a first determination result; if the first determination result is yes, the core concept layer updating module 7 is called; if the first determination result is no, the fusion knowledge graph is taken as a final steel material science knowledge graph.
[0156] The core concept layer updating module 7 is configured to update the new core concept word into the core concept layer, and re-call the field database construction module 2.
[0157] In this embodiment, the core concept layer determining module 1 comprises:
[0158] The text information acquisition unit 11 is configured to acquire a plurality of pieces of text information of steel material science.
[0159] The word segmentation processing unit 12 is configured to perform word segmentation processing on each piece of text information, to obtain a plurality of words, and the part of speech of each word, the text information to which each word belongs, and the position of each word in the text information.
[0160] The reserved word set determining unit 13 is configured to remove the duplicates of each word, and filter each word according to the part of speech of each word, to retain the words with the part of speech of noun, organization, special-purpose noun, verb and gerund as a reserved word set.
[0161] The TF-IDF score calculating unit 14 is configured to calculate the TF-IDF score of each word in the reserved word set, and sort each word in descending order according to the TF-IDF score.
[0162] The core keyword determining unit 15 is configured to select the top N words as core keywords.
[0163] The core associated word determining unit 16 is configured to select, as a core associated word, a word with a frequency of occurrence greater than that of other words from a plurality of words recorded before and after the core keyword according to the position of the core keyword in the text information; and the core keyword and the core associated word jointly constitute a core concept word.
[0164] The core concept layer construction unit 17 is configured to construct a core concept layer according to the inter-word relationship between the core concept words; the inter-word relationship comprises an upper-lower relationship, a synonymous relationship, an attribute relationship, a concept instance relationship and a general relationship.
[0165] In this embodiment, the TF-IDF score of each word in the reserved word set is calculated according to the following formula:
[0166]
[0167] wherein F m represents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, i represents the number of text information.
[0168] In this embodiment, the similarity score between each pair of entity vectors is calculated according to the following formula:
[0169]
[0170] wherein EA and EB represent different entity vectors respectively, and n is the dimension of the entity vector.
[0171] In this document, specific examples are applied, but the above description is only to illustrate the principles and implementation manners of the present application, and the description of the above examples is only to help understanding the method of the present application and its core idea; those skilled in the art should understand that the above modules or steps of the present application can be realized by a general computer device, alternatively, they can be realized by program codes executable by a computing device, so that they can be stored in a storage device and executed by a computing device, or they can be respectively manufactured into each integrated circuit module, or a plurality of modules or steps among them can be manufactured into a single integrated circuit module to realize. The present application is not limited to any specific combination of hardware and software.
[0172] Meanwhile, for those skilled in the art, according to the idea of the present application, there will be changes in specific implementation manners and application scope. In conclusion, the content of the present description should not be understood as a limitation of the present application.
Claims
1. A method for constructing a knowledge graph of steel materials, characterized in that, The steel material science knowledge graph construction method comprises: Obtaining text information of steel material science, selecting a plurality of core concept words from each text information, and constructing a core concept layer; According to the core concept layer, obtaining the domain data related to each core concept word to obtain a domain database; the domain database includes structured domain data and unstructured domain data; Using the IDCNN-CRF model to perform entity extraction and attribute extraction on the unstructured domain data to obtain structured domain data; According to the structured domain data and the word relationship between the domain data, an initial knowledge graph is constructed; the initial knowledge graph includes a plurality of entity triples, and the entity triples include a head entity, a tail entity and a head-tail relationship; Using the TransE model to convert each entity triple into an entity vector, calculating the similarity score between each entity vector, and fusing two entity vectors with a similarity score greater than a preset threshold to obtain a fused knowledge graph; Clustering the entities in the fused knowledge graph, determining whether there is a new core concept word, and obtaining a first determination result; If the first determination result is yes, the new core concept word is updated to the core concept layer, and the step of "obtaining the domain data related to each core concept word according to the core concept layer to obtain a domain database" is jumped to; If the first determination result is no, the fused knowledge graph is taken as the final steel material science knowledge graph; The method for obtaining text information of steel material science, selecting a plurality of core concept words from each text information, and constructing a core concept layer comprises: Obtaining a plurality of text information of steel material science; Performing word segmentation processing on each text information to obtain a plurality of words, and the part of speech of each word, the text information to which each word belongs and the position of each word in the text information; Removing each word, and filtering each word according to the part of speech of each word, retaining the words with the part of speech of noun, verb and gerund as the reserved word set; the words with the part of speech of noun include institutions and special nouns; Calculating the TF-IDF score of each word in the reserved word set, and sorting each word in descending order according to the TF-IDF score; Selecting the top N words as core keywords; According to the position of each core keyword in the text information, selecting the words appearing more frequently than other words from the words recorded before and after the core keyword as core associated words; the core keyword and the core associated word together constitute a core concept word; According to the word relationship between each core concept word, a core concept layer is constructed; the word relationship includes upper and lower relationship, synonymous relationship, attribute relationship, concept instance relationship and general relationship.
2. The steel material science knowledge graph construction method according to claim 1, characterized in that, The TF-IDF score of each word in the reserved word set is calculated according to the following formula: wherein F m represents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, and i represents the number of text information.
3. The steel material science knowledge graph construction method of claim 1, wherein, Before using the IDCNN-CRF model to perform entity extraction and attribute extraction on the unstructured domain data, the steel material science knowledge graph construction method further comprises: The field data is segmented by using a segmentation algorithm, and a sentence vector of the field data is calculated according to a word vector of each segment; The field data is clustered by using a k-means clustering algorithm according to the sentence vector of each field data, and a plurality of clustering piles are obtained; An equal proportion of field data in each clustering pile is selected as a manual annotation set, wherein the manual annotation set includes a plurality of field data and an annotation label of each character of the field data, and the annotation label includes an entity, an attribute, an attribute value, and an irrelevant value; The manual annotation set is divided into a training set, a validation set, and a test set according to a preset proportion; An IDCNN-CRF model is trained by using the training set, the field data is input, and an annotation label of each character of the field data is taken as a target output, so as to obtain an initial IDCNN-CRF model; The hyperparameters of the initial IDCNN-CRF model are adjusted by using the validation set, so as to obtain an adjusted IDCNN-CRF model; The test set is input into the adjusted IDCNN-CRF model, and an evaluation index is calculated according to an annotation label of each character of field data predicted by the adjusted IDCNN-CRF model and an annotation label of each character of field data in the test set; If the evaluation index is higher than a preset index threshold, the field data is extracted for an entity and an attribute by using the adjusted IDCNN-CRF, so as to obtain structured field data. If the evaluation index is lower than the preset index threshold, the manual annotation set is re-annotated, and the step of training the IDCNN-CRF model by using the training set, inputting the field data, and taking the annotation label of each character of the field data as the target output is jumped to obtain the initial IDCNN-CRF model.
4. The steel material science knowledge graph construction method of claim 1, wherein, The loss function of the TransE model is as follows: wherein S represents a set of triples of the initial knowledge graph; (E h ,E l ,E t ) is a triple in the set of triples, E h is a head entity in the triple, E l is a head-tail relation in the triple, E t is a tail entity in the triple, (E h` ,E l ,E t` ) is a negative example triple obtained by randomly replacing the head entity and the tail entity of the triple, γ represents an allowable error of a correct triple and the negative example triple, ||2 represents an L2 norm, [] + represents a hinge loss function, and takes a non-negative result.
5. The steel material science knowledge graph construction method according to claim 1, characterized in that, The similarity scores between each pair of entity vectors are calculated according to the following formula, and specifically include: Wherein, EA and EB represent different entity vectors, and n is the dimension of the entity vector.
6. A steel material knowledge graph construction system, characterized by, The steel material science knowledge graph construction system comprises: A core concept layer determination module is configured to obtain text information of steel material science, select a plurality of core concept words from the text information of steel material science, and determine a core concept layer; A domain database construction module is configured to obtain domain data related to the core concept words according to the core concept layer, and obtain a domain database; the domain database includes structured domain data and unstructured domain data; A structured data extraction module is configured to extract an entity and an attribute from the unstructured domain data by using an IDCNN-CRF model, and obtain structured domain data. An initial knowledge graph construction module is configured to construct an initial knowledge graph based on structured domain data and word-to-word relationships between core concept words corresponding to the domain data; the initial knowledge graph includes a plurality of entity triples, and each entity triple includes a head entity, a tail entity, and a head-tail relationship; An entity vector fusion module is configured to convert each entity triple into an entity vector by using a TransE model, calculate similarity scores between each pair of entity vectors, and fuse two entity vectors with a similarity score greater than a preset threshold to obtain a fused knowledge graph; A domain data clustering module is configured to cluster entities in the fused knowledge graph, determine whether there is a new core concept word, and obtain a first determination result; if the first determination result is yes, a core concept layer updating module is invoked; if the first determination result is no, the fused knowledge graph is taken as a final steel material science knowledge graph; The core concept layer updating module is configured to update the new core concept word to the core concept layer and re-invoke the domain database construction module; The core concept layer determination module includes: A text information acquisition unit is configured to acquire a plurality of text information of steel material science; A word segmentation processing unit is configured to perform word segmentation processing on each text information to obtain a plurality of words, and the part of speech of each word, the text information to which each word belongs, and the position of each word in the text information; A reserved word set determination unit is configured to remove duplicates from each word, and filter each word according to the part of speech of each word, and reserve words with the part of speech of noun, verb, and gerund as a reserved word set; the words with the part of speech of noun include institutional bodies and special nouns; A TF-IDF score calculation unit is configured to calculate the TF-IDF score of each word in the reserved word set, and sort each word in descending order according to the TF-IDF score; A core keyword determination unit is configured to select the top N words as core keywords; A core associated word determination unit is configured to select a word with a frequency of occurrence greater than that of other words as a core associated word from a plurality of words recorded before and after each core keyword in the text information to which the core keyword belongs; the core keyword and the core associated word together form a core concept word; A core concept layer construction unit is configured to construct a core concept layer based on word-to-word relationships between core concept words; the word-to-word relationships include superior-inferior relationships, synonymous relationships, attribute relationships, concept instance relationships, and general relationships.
7. The steel materials knowledge graph construction system of claim 6, wherein, The TF-IDF score of each word in the reserved word set is calculated according to the following formula: wherein F m represents the number of times the word appears in each text information, N represents the number of words in the reserved word set, D m represents the number of text information including the word, and i represents the number of text information. 8.The steel material science knowledge graph construction system according to claim 6, characterized in that, The similarity score between each pair of entity vectors is calculated according to the following formula: where EA and EB represent different entity vectors, and n is the dimension of the entity vector.
Citation Information
Patent Citations
Knowledge graph generation tool with user-defined configuration
CN112559704A