Methods for extracting knowledge entities and relations from text information and methods for assessing text quality.
Through the knowledge entity and relationship extraction method, combined with the mutual information algorithm and the improved TextRank algorithm, the problem of insufficient information extraction capabilities of text data is solved, the accuracy of knowledge entity extraction and text quality assessment are improved, and text evaluation indicators from a complex network perspective are provided. .
Patent Information
- Application Number
- CN202111251665.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-10-26
AI Technical Summary
When extracting information from text data, the existing technology lacks information acquisition capabilities and fails to comprehensively consider the information in the text, resulting in insufficient information acquisition.
The knowledge entity and relationship extraction method is adopted, the phrase importance index is calculated through the mutual information algorithm, the improved TextRank algorithm based on word vectors is used to calculate the importance of the knowledge entity, and the knowledge entity relationship is determined based on the occurrence probability and refinement of the knowledge entity, and the knowledge entity database is constructed. Text entity network diagram to evaluate text quality.
It improves the accuracy of knowledge entity extraction, can recombine the original words lost when extracting knowledge entities, enhances the quality assessment ability of text information, and provides text evaluation indicators based on a complex network perspective to help analyze and evaluate text information.
Smart Images

Figure CN114048742B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text processing, and in particular to a method for extracting knowledge entities and relations from text information and a method for evaluating text quality. Background Art
[0002] With the rapid development of the Internet, various resource information is becoming increasingly abundant and even exploding; and text carries a wealth of information, so the study of text needs to be paid more and more attention. Therefore, it is very important to extract the content of interest from the huge text. The purpose of information extraction is to provide people with a powerful information acquisition tool.
[0003] A piece of text may contain a large amount of knowledge and information, which is an important and common data format. Using computer algorithms to extract and mine the key points of text data can help us obtain a large amount of refined knowledge entity data in a short period of time, quickly capture key information, and improve text reading efficiency and quality. However, the current methods for extracting and mining text data do not comprehensively consider the information in the text, resulting in insufficient information acquisition capabilities. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method for extracting knowledge entities and relationships from text information and a method for evaluating text quality, so as to solve the technical problem of insufficient information acquisition capability when extracting information from text data in the prior art.
[0005] The technical solution proposed by the present invention is as follows:
[0006] A first aspect of an embodiment of the present invention provides a method for extracting knowledge entities and relationships from text information, comprising: acquiring text data; extracting knowledge entities from the text data; calculating the phrase importance index of the knowledge entity based on a mutual information algorithm; calculating the importance of the knowledge entity based on an improved TextRank algorithm based on word vectors; and determining the relationship between the knowledge entities based on the probability of occurrence and the degree of refinement of the knowledge entities.
[0007] Optionally, the method for extracting knowledge entities and relationships from text information further includes: performing part-of-speech tagging on the knowledge entities; and constructing a knowledge entity database based on the knowledge entities, part-of-speech tagging results, phrase importance indexes, knowledge entity importance, and knowledge entity relationships.
[0008] Optionally, calculating the phrase importance index of the knowledge entity according to the mutual information algorithm includes: combining two knowledge entities among the extracted knowledge entities; calculating the cosine mutual information value of the combined knowledge entity according to the mutual information algorithm; and calculating the phrase importance index of the combined knowledge entity according to the cosine mutual information value, wherein the phrase importance index is expressed by the following formula:
[0009]
[0010] Among them, Q–V represents the phrase importance index, and PMI-C represents the cosine mutual information value.
[0011] Optionally, the importance of knowledge entities is calculated according to an improved TextRank algorithm based on word vectors, including: calculating the word vector of each knowledge entity; calculating the Rank index of the knowledge entity according to the word vector and the improved TextRank algorithm, the improved TextRank algorithm including constructing a keyword network according to the knowledge entity, the keyword network including each keyword node in the network, directed and authorized edges between keywords determined according to the network construction scope, and vector distances of the keywords; calculating the reverse text frequency of each knowledge entity; and calculating the importance of the knowledge entity according to the Rank index and the reverse text frequency.
[0012] Optionally, determining the relationship between knowledge entities based on the probability of occurrence and the degree of refinement of the knowledge entities includes: traversing the text data to determine the document set corresponding to the knowledge entity; calculating the probability of occurrence of the knowledge entity based on the document set corresponding to the knowledge entity; calculating the degree of refinement of the knowledge entity based on the probability of occurrence of the knowledge entity; and determining the relationship between knowledge entities based on the document set corresponding to the knowledge entity and the degree of refinement of the knowledge entity.
[0013] The second aspect of an embodiment of the present invention provides a text quality assessment method, comprising: obtaining the knowledge entity importance and knowledge entity relationship calculated in the first aspect of the embodiment of the present invention; constructing a text entity network diagram based on the knowledge entity relationship; calculating the average degree, diameter, average path length and clustering coefficient based on the text entity network diagram; and assessing the text quality based on the average degree, diameter, average path length, clustering coefficient and knowledge entity importance.
[0014] Optionally, the text quality is evaluated based on the average degree, diameter, average path length, clustering coefficient and knowledge entity importance, including: calculating the text topic focus based on the diameter and clustering coefficient; calculating the text knowledge architecture quality based on the average degree, average path length, clustering coefficient and knowledge entity importance.
[0015] The third aspect of an embodiment of the present invention provides a device for extracting knowledge entities and relationships from text information, including: a text data acquisition module for acquiring text data; a knowledge entity extraction module for extracting knowledge entities from the text data; an importance index calculation module for calculating the phrase importance index of the knowledge entity based on a mutual information algorithm; an importance calculation module for calculating the importance of knowledge entities based on an improved TextRank algorithm based on word vectors; and a knowledge entity relationship determination module for determining knowledge entity relationships based on the probability of occurrence and refinement of the knowledge entities.
[0016] The fourth aspect of the embodiment of the present invention provides a text quality assessment device, including: a data acquisition module, which acquires the knowledge entity importance and knowledge entity relationship calculated by the first aspect of the embodiment of the present invention; a network diagram construction module, which is used to construct a text entity network diagram according to the knowledge entity relationship; a parameter calculation module, which is used to calculate the average degree, diameter, average path length and clustering coefficient according to the text entity network diagram; and an assessment module, which is used to evaluate the text quality according to the average degree, diameter, average path length, clustering coefficient and knowledge entity importance.
[0017] A fifth aspect of an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the knowledge entity and relationship extraction method of text information as described in the first aspect of the embodiment of the present invention and any one of the first aspects, and to execute the text quality assessment method as described in the second aspect of the embodiment of the present invention and any one of the second aspects.
[0018] A sixth aspect of an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the knowledge entity and relationship extraction method of text information as described in the first aspect of the embodiment of the present invention and any one of the first aspects, and to execute the text quality assessment method as described in the second aspect of the embodiment of the present invention and any one of the second aspects.
[0019] The technical solution provided by the present invention has the following effects:
[0020] The method for extracting knowledge entities and relationships from text information provided by the embodiment of the present invention, after extracting knowledge entities from text data, calculates the phrase importance index of the knowledge entity according to the mutual information algorithm; calculates the importance of the knowledge entity according to the improved TextRank algorithm based on word vectors; and determines the relationship of the knowledge entity according to the probability of occurrence and refinement of the knowledge entity. Therefore, the method can recombine the original words lost when extracting the knowledge entity by calculating the phrase importance index, thereby improving the accuracy of knowledge entity extraction; at the same time, by calculating the importance of the knowledge entity, it can facilitate the subsequent quality assessment of the extracted text information; in addition, the method also proposes to determine the relationship of the knowledge entity based on the probability of occurrence and refinement of the knowledge entity, and the determination of the relationship of the knowledge entity can facilitate further analysis of the text information.
[0021] The text quality assessment method provided by the embodiment of the present invention constructs a text entity network diagram through knowledge entity relationships, determines various indicators for assessing text quality through the network diagram, and finally comprehensively evaluates the text quality by combining multiple indicators and the importance of knowledge entities. Therefore, the text quality assessment method reconsiders the relationship representation method between entities from a complex network perspective, proposes a text assessment indicator based on entity relationships, and provides ideas and references for exploring the quality of text content in characteristic fields. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 is a flow chart of a method for extracting knowledge entities and relationships from text information according to an embodiment of the present invention;
[0024] Figure 2 is a flow chart of a method for extracting knowledge entities and relationships from text information according to another embodiment of the present invention;
[0025] Figure 3 is a flow chart of a method for extracting knowledge entities and relationships from text information according to another embodiment of the present invention;
[0026] Figure 4 is a flow chart of a method for extracting knowledge entities and relationships from text information according to another embodiment of the present invention;
[0027] Figure 5 is a flowchart of a text quality assessment method according to an embodiment of the present invention;
[0028] Figure 6 is a structural block diagram of a device for extracting knowledge entities and relationships from text information according to an embodiment of the present invention;
[0029] Figure 7 is a structural block diagram of a text quality assessment device according to an embodiment of the present invention;
[0030] Figure 8 is a schematic diagram of the structure of a computer-readable storage medium provided according to an embodiment of the present invention;
[0031] Fig. 9 is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0033] The embodiment of the present invention provides a method for extracting knowledge entities and relationships from text information. Figure 1 As shown, the method comprises the following steps:
[0034] Step S101: Acquire text data; specifically, the text data is text data of knowledge entities and relationships to be extracted. The text data can be acquired from the Internet or from other places, and the embodiment of the present invention does not limit the location of acquiring the text data. In one embodiment, the text data can be a forum post on certain topics, a speech on a certain topic or a certain class, or a blog content on a certain topic. The acquired text data can be stored in text form.
[0035] Step S102: extracting knowledge entities from the text data; wherein the knowledge entity may be a keyword in the text data, or may also refer to a proper noun or phrase with a specific and complete semantics, a fixed structure, and a noun attribute that can better express a semantic concept. Specifically, the TextRank algorithm may be used to extract the knowledge entity. The knowledge entity may be used as a knowledge keyword of the text data.
[0036] In one embodiment, when extracting knowledge entities from text data, the extracted text data may also be subjected to processes such as text segmentation and part-of-speech tagging. Part-of-speech tagging refers to assigning a suitable part-of-speech to each word in a sentence, that is, to determine whether each word is a part-of-speech attribute, such as a noun, a verb, or an adjective. There are many part-of-speech tagging standards, such as the PKU tag set provided by the Institute of Computational Linguistics of Peking University. In this embodiment, part-of-speech tagging is performed based on the PKU tagging rules of the Institute of Computational Linguistics of Peking University.
[0037] Step S103: Calculate the phrase importance index of the knowledge entity according to the mutual information algorithm; specifically, mutual information is a concept in information theory, which is used to measure the correlation between two random events. In terms of word combination, for two segmented segments V1 and V2 of a phrase V, the pointwise mutual information (PMI) between the two segments can be calculated.
[0038]
[0039] PMI (V1, V2) is a consistency feature of the text. The larger the PMI (V1, V2) value, the greater the correlation between V1 and V2, and they can be combined into a phrase. On the contrary, the smaller the correlation is, and when it is below a certain threshold, they cannot form a phrase.
[0040] In one embodiment, text segmentation is performed when extracting knowledge entities. However, due to the limitations of the samples trained by the segmentation tool and the accuracy of the algorithm itself, keywords in this field may be cut off during the segmentation process. For example, the keyword "Internet + Education" is usually simply cut into two keywords "Internet" and "Education" during segmentation, and the original word is lost. The calculation of the above phrase importance index can determine whether it is necessary to connect the field-related entities based on the existing entities to form an entity phrase.
[0041] Step S104: Calculate the importance of the knowledge entity according to the improved TextRank algorithm based on word vectors; specifically, when calculating the importance of the knowledge entity, the word vector of the knowledge entity can be calculated first, and then the importance of the knowledge entity is calculated based on the improved TextRank algorithm and the calculated word vector.
[0042] Step S105: Determine the knowledge entity relationship based on the probability of occurrence and the degree of refinement of the knowledge entity. Specifically, the knowledge entity relationship includes a hierarchical relationship and a co-occurrence relationship. Among them, the hierarchical relationship means that if A is the superordinate entity of B, the meaning represented by A is broader than that of B, and the meaning represented by B is more specific than that of A. The co-occurrence relationship means that if A and B co-occur, they are generally considered to be in a peer relationship, mostly referring to different aspects of the same thing.
[0043] Among them, refinement is an indicator that reflects the relationship between entities. Entities with high refinement are usually located in the lower level. The entity occurrence probability refers to the probability of V1 appearing in the document where entity V2 appears. The entity occurrence probability and refinement can be used to determine whether the relationship between two knowledge entities is a hierarchical relationship or a co-occurrence relationship.
[0044] The method for extracting knowledge entities and relationships from text information provided by the embodiment of the present invention, after extracting knowledge entities from text data, calculates the phrase importance index of the knowledge entity according to the mutual information algorithm; calculates the importance of the knowledge entity according to the improved TextRank algorithm based on word vectors; and determines the relationship of the knowledge entity according to the probability of occurrence and refinement of the knowledge entity. Therefore, the method can recombine the original words lost when extracting the knowledge entity by calculating the phrase importance index, thereby improving the accuracy of knowledge entity extraction; at the same time, by calculating the importance of the knowledge entity, it can facilitate the subsequent quality assessment of the extracted text information; in addition, the method also proposes to determine the relationship of the knowledge entity based on the probability of occurrence and refinement of the knowledge entity, and the determination of the relationship of the knowledge entity can facilitate further analysis of the text information.
[0045] As an optional implementation of an embodiment of the present invention, the method for extracting knowledge entities and relationships from text information also includes: tagging the knowledge entities with parts of speech; and constructing a knowledge entity database based on the knowledge entities, the results of part of speech tagging, the importance index of phrases, the importance of knowledge entities, and the relationships between knowledge entities. Specifically, by storing indicators such as entity content, entity importance, phrase content, phrase importance, and the relationship between upper and lower entities in the knowledge entity database as a special knowledge base in the field of Internet text, it is convenient for possible future research and analysis.
[0046] As an optional implementation of the embodiment of the present invention, Figure 2 As shown, calculating the phrase importance index of the knowledge entity according to the mutual information algorithm includes the following steps:
[0047] Step S201: Combine two knowledge entities in the extracted knowledge entities; Specifically, it can be seen from the above content that when extracting knowledge entities, the original phrases may be split up and the original words may be lost after the text segmentation. Therefore, in order to retrieve the original words, two knowledge entities in the extracted knowledge entities can be combined. For example, entity V1 and V2 are combined to obtain entity V.
[0048] Step S202: Calculate the cosine mutual information value of the combined knowledge entity according to the mutual information algorithm; specifically, after combining the entities, calculate the cosine mutual information value of the combined knowledge entity. For example, if the two combined knowledge entities are V1 and V2, the cosine mutual information value of the combined knowledge entity V is calculated by the following formula:
[0049]
[0050]
[0051] Among them, cosθ is the word distance based on the entity word vector. PMI-C(V1,V2) represents the cosine mutual information value of the combined knowledge entity V, reflecting the importance of the combined entity V.
[0052] Step S203: Calculate the phrase importance index of the combined knowledge entity according to the cosine mutual information value. Specifically, when calculating the phrase importance index, the combined knowledge entity V can be given an application scenario to calculate the importance of the entity phrase V in the corresponding scenario. When calculating, the inverse document frequency of V is calculated based on logistic regression to re-evaluate the text importance of entity V. The phrase importance index is calculated by the following formula:
[0053]
[0054] As an optional implementation of the embodiment of the present invention, Figure 3 As shown in the figure, the importance of knowledge entities is calculated according to the improved TextRank algorithm based on word vectors, including the following steps:
[0055] Step S301: Calculate the word vector of each knowledge entity; specifically, if there are N pieces of input text data, the N pieces of text are recorded as W 1~N , and determine the index entity i extracted from each text and the order information S of its first appearance in the text 1~p When calculating the word vector of each knowledge entity, the Word2Vec model in natural language processing may be used for calculation, or the Glove model or the BERT model may be used for calculation. Alternatively, other models may be used, which is not limited in the embodiment of the present invention.
[0056] Step S302: Calculate the Rank index of the knowledge entity based on the word vector and the improved TextRank algorithm; specifically, when calculating the Rank index, first construct a keyword network G = (V, E), where V represents the keywords contained in the keyword network, which can be used as a node in the network. If two keywords appear in a window, an edge E is established for the two keywords. The edge here is directed. According to the order in which each knowledge entity or keyword appears in the above step S301, the one that appears first in a window is the upper keyword, and the one that appears later is the lower keyword, and the direction is from the upper keyword to the lower keyword. Among them, the window refers to the scope of the network construction. For example, if a total of 100 keywords are extracted and the window is 10, then the above process must be repeated 10 times in total.
[0057] Therefore, the Rank index WS of the knowledge entity can be calculated by the following formula:
[0058]
[0059] Among them, d is the damping coefficient, which represents the probability that a node in the graph network points to other nodes. Its value range is (0, 1) and can generally be set to 0.85; ω ji is the weight coefficient, i.e., the vector distance D of the keyword, In(V i ) is the set of points pointing to the node, Out(V j ) is the node V i The set of points pointed to by it iteratively calculates the weight of each node until convergence.
[0060] Step S303: Calculate the inverse text frequency of each knowledge entity; specifically, the inverse text frequency IDF refers to a measure of the general importance of a word. The IDF of a particular word can be obtained by dividing the total number of documents by the number of documents containing the word, and then taking the logarithm of the quotient. If the fewer documents contain the term t, the larger the IDF, which means that the term has a good ability to distinguish categories. Therefore, the inverse text frequency can be calculated by the following formula:
[0061]
[0062] Where |D| is the total number of documents in the corpus. |{j:ti∈dj}| represents the number of documents containing word ti (i.e., the number of documents with ni, j≠0). If the word is not in the corpus, the denominator will be zero, so 1+|{j:ti∈dj}| is generally used. That is, IDF is equal to the total number of documents in the corpus and the number of documents containing the term w + 1, then the logarithm is taken.
[0063] Step S304: Calculate the knowledge entity importance based on the Rank index and the inverse text frequency. Specifically, the knowledge entity importance can be obtained based on the multiplication of the Rank index WS and the inverse document frequency, that is, the knowledge entity importance Q = WS * IDF.
[0064] As an optional implementation of the embodiment of the present invention, Figure 4 As shown, determining the knowledge entity relationship according to the occurrence probability and refinement degree of the knowledge entity includes the following steps:
[0065] Step S401: traverse the text data to determine the document set corresponding to the knowledge entity; specifically, after extracting the knowledge entity, traverse the entity in the document, number the document, and establish a document number set for the V entity. V = {D1, D2, D4}, indicating that entity V appears in documents D1, D2, and D4. If for two entities V1 and V2, and It can be considered that V2 is the superordinate concept of V1, and V1 is the subordinate concept of V2.
[0066] Step S402: Calculate the occurrence probability of the knowledge entity according to the document set corresponding to the knowledge entity; specifically, the entity occurrence probability can be calculated by the following formula:
[0067]
[0068] Among them, P(V1|V2) represents the probability of entity V1 appearing in the document where entity V2 appears, N(V1V2) is the number of documents where entities V1 and V2 appear at the same time, N(V2) represents the number of documents where entity V2 appears, and when P(V1|V2)≥0.8, V1 and V2 are considered to have a hierarchical relationship.
[0069] Step S403: Calculate the knowledge entity refinement degree according to the knowledge entity occurrence probability; specifically, when calculating the refinement degree, it can be calculated based on the entity occurrence probability. The refinement degree is calculated by the following formula:
[0070]
[0071] Among them, the N(V) value represents the refinement value. When entity V and any entity in the knowledge entity database satisfy P(V0|V)≥0.8, N(V) increases by 1, and N is the total number of entities in the knowledge entity database.
[0072] Step S404: Determine the knowledge entity relationship based on the document set corresponding to the knowledge entity and the knowledge entity refinement. Specifically, after determining the occurrence of the knowledge entity in the document and the refinement, the knowledge entity relationship can be determined in the following manner: and And R v1 <R v2 , then V1 is the superordinate entity of V2; if and And R v1 >R v2 , then V1 is a subordinate entity of V2; in other cases, V1 and V2 are considered to have a level relationship, that is, a co-occurrence relationship.
[0073] The embodiment of the present invention also provides a text quality assessment method, such as Figure 5 As shown, the evaluation method includes the following steps:
[0074] Step S501: Obtain the knowledge entity importance and knowledge entity relationship calculated by the knowledge entity and relationship extraction method of the text information; specifically, when obtaining the knowledge entity importance and knowledge entity relationship, they can be obtained from the knowledge entity data constructed by the above method, or they can be directly calculated using the above calculation method.
[0075] Step S502: Construct a text entity network diagram based on the knowledge entity relationship. Specifically, according to the above content, knowledge entity relationships are divided into three types of relationships: a) V1 is the superordinate of V2; b) V1 is the subordinate of V2; c) V1 and V2 co-occur. Therefore, based on the superordinate-superordinate relationship, a directed graph α of entity superordinate-superordinate relationship can be established, with the edge pointing from the superordinate node to the subordinate node; based on the co-occurrence relationship, an undirected graph β of entity co-occurrence relationship can be established, and the edge establishment indicates the co-occurrence between two entities.
[0076] Step S503: Calculate the average degree, diameter, average path length and clustering coefficient according to the text entity network diagram; specifically, after constructing the text entity network diagram, an evaluation index for evaluating the text quality can be calculated based on the relationship between the entities in the diagram.
[0077] The average degree k refers to the degree of all nodes (the out-degree k of the directed graph is the average degree k of all nodes). out or in-degree k in ) to the number of nodes, where N represents the number of nodes in the graph. The average degree represents the connection of entities in the network and can be used as one of the indicators for evaluating the connectivity of text knowledge. A network with a higher average degree means that the connectivity between entities in the text is stronger and the entities are closely connected.
[0078] For a directed graph α, the average degree is calculated as:
[0079]
[0080]
[0081] For an undirected graph β, the average degree is calculated as:
[0082]
[0083]
[0084] The diameter of a network is defined as the maximum distance between all pairs of nodes in the network (the distance between any two nodes). This indicator represents the breadth of the network, that is, the extensiveness of the text content. The higher the diameter D of a physical network, the more extensive and universal its text content is.
[0085] The average path length L refers to the average distance of all node pairs, which is the average distance (Mean Distance). The average path length L represents the most likely typical distance between two entity nodes. This indicator represents the "size" of the network, that is, the effective coverage of the text content. The longer the knowledge network L is, the better the knowledge structure of the text is.
[0086] The clustering coefficient C is a parameter that measures the degree of node clustering. The clustering coefficient of a single node is the ratio of the number of edges between all its adjacent nodes to the maximum possible number of edges. The clustering coefficient C of the network is the average of the clustering coefficients of all nodes. The clustering coefficient can characterize the degree of clustering between entities in the text. Generally speaking, the higher the clustering coefficient of the entity network, the more focused and obvious its discourse topic is. Therefore, the clustering coefficient of a single node and the clustering coefficient of the network (clustering coefficient) are calculated using the following formulas:
[0087]
[0088]
[0089] Step S504: Evaluate the text quality according to the average degree, diameter, average path length, clustering coefficient and knowledge entity importance. Specifically, during the evaluation, the text topic focus is calculated according to the diameter and clustering coefficient, that is, the text topic focus P is calculated by the following formula:
[0090]
[0091] In addition, the text knowledge architecture quality can also be calculated based on the average degree, average path length, clustering coefficient and knowledge entity importance, that is, the text knowledge architecture quality M is calculated by the following formula:
[0092]
[0093] The text quality assessment method provided by the embodiment of the present invention constructs a text entity network diagram through knowledge entity relationships, determines various indicators for assessing text quality through the network diagram, and finally comprehensively evaluates the text quality by combining multiple indicators and the importance of knowledge entities. Therefore, the text quality assessment method reconsiders the relationship representation method between entities from a complex network perspective, proposes a text assessment indicator based on entity relationships, and provides ideas and references for exploring the quality of text content in characteristic fields.
[0094] The knowledge entity and relationship extraction device of text information provided by the embodiment of the present invention is as follows: Figure 6 As shown, the device comprises:
[0095] The text data acquisition module is used to acquire text data; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0096] The knowledge entity extraction module is used to extract the knowledge entities in the text data; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0097] The importance index calculation module is used to calculate the phrase importance index of the knowledge entity according to the mutual information algorithm; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0098] The importance calculation module is used to calculate the importance of knowledge entities according to the improved TextRank algorithm based on word vectors; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0099] The knowledge entity relationship determination module is used to determine the knowledge entity relationship according to the probability of occurrence of the knowledge entity and the degree of refinement. For details, please refer to the corresponding part of the above method embodiment, which will not be repeated here.
[0100] The knowledge entity and relationship extraction device for text information provided by the embodiment of the present invention calculates the phrase importance index of the knowledge entity according to the mutual information algorithm after extracting the knowledge entity from the text data; calculates the importance of the knowledge entity according to the improved TextRank algorithm based on the word vector; and determines the relationship of the knowledge entity according to the probability of occurrence and refinement of the knowledge entity. Therefore, the device can recombine the original words lost when extracting the knowledge entity by calculating the phrase importance index, thereby improving the accuracy of knowledge entity extraction; at the same time, by calculating the importance of the knowledge entity, it can facilitate the subsequent quality evaluation of the extracted text information; in addition, the device also proposes to determine the relationship of the knowledge entity based on the probability of occurrence and refinement of the knowledge entity, and the determination of the relationship of the knowledge entity can facilitate further analysis of the text information.
[0101] For a detailed description of the functions of the apparatus for extracting knowledge entities and relationships from text information provided in an embodiment of the present invention, please refer to the description of the method for extracting knowledge entities and relationships from text information in the above embodiment.
[0102] The text quality assessment device provided by the embodiment of the present invention is as follows: Figure 7 As shown, the device comprises:
[0103] The data acquisition module obtains the knowledge entity importance and knowledge entity relationship calculated by the knowledge entity and relationship extraction method of the above text information; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0104] The network diagram construction module is used to construct a text entity network diagram based on the knowledge entity relationship; the specific content can be found in the corresponding part of the above method embodiment, which will not be repeated here.
[0105] The parameter calculation module is used to calculate the average degree, diameter, average path length and clustering coefficient according to the text entity network diagram; the specific content refers to the corresponding part of the above method embodiment, which will not be repeated here.
[0106] The evaluation module is used to evaluate the text quality according to the average degree, diameter, average path length, clustering coefficient and importance of knowledge entities. For details, please refer to the corresponding part of the above method embodiment, which will not be repeated here.
[0107] The text quality assessment device provided by the embodiment of the present invention constructs a text entity network diagram through knowledge entity relationships, determines various indicators for assessing text quality through the network diagram, and finally comprehensively evaluates the text quality by combining multiple indicators and the importance of knowledge entities. Therefore, the text quality assessment device reconsiders the relationship representation method between entities based on the perspective of complex networks, and proposes a text assessment indicator based on entity relationships, which provides ideas and references for exploring the quality of text content in characteristic fields.
[0108] For a detailed description of the functions of the text quality assessment device provided in the embodiment of the present invention, please refer to the description of the text quality assessment method in the above embodiment.
[0109] The embodiment of the present invention also provides a storage medium, such as Figure 8 As shown, a computer program 601 is stored thereon, and when the instruction is executed by the processor, the steps of the method for extracting knowledge entities and relationships of text information in the above embodiment are implemented. The storage medium also stores audio and video stream data, feature frame data, interaction request signaling, encrypted data, and preset data size, etc. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memory.
[0110] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0111] The embodiment of the present invention further provides an electronic device, such as Fig. 9 As shown, the electronic device may include a processor 51 and a memory 52, wherein the processor 51 and the memory 52 may be connected via a bus or other means. Fig. 9The example of connecting through bus is taken in the following.
[0112] The processor 51 may be a central processing unit (CPU). The processor 51 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0113] The memory 52 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as the corresponding program instructions / modules in the embodiment of the present invention. The processor 51 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 52, that is, the knowledge entity and relationship extraction method of the text information in the above method embodiment is implemented.
[0114] The memory 52 may include a program storage area and a data storage area, wherein the program storage area may store an application required for operating the device and at least one function; the data storage area may store data created by the processor 51, etc. In addition, the memory 52 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 52 may optionally include a memory remotely arranged relative to the processor 51, and these remote memories may be connected to the processor 51 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0115] The one or more modules are stored in the memory 52 and when executed by the processor 51, perform the following steps: Figure 1-5 The method for extracting knowledge entities and relationships from text information in the illustrated embodiment.
[0116] For details of the above electronic equipment, please refer to Figures 1 to 5 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.
[0117] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for extracting knowledge entities and relationships from text information, characterized in that: include: Get text data; Extracting knowledge entities from the text data; Calculate the phrase importance index of the knowledge entity according to the mutual information algorithm; The importance of knowledge entities is calculated using the improved TextRank algorithm based on word vectors; Determine the relationship between knowledge entities based on the probability of occurrence and refinement of knowledge entities; Calculating the phrase importance index of the knowledge entity according to the mutual information algorithm includes: Combine two knowledge entities among the extracted knowledge entities; Calculate the cosine mutual information value of the combined knowledge entity according to the mutual information algorithm; The phrase importance index of the combined knowledge entity is calculated according to the cosine mutual information value, and the phrase importance index is expressed by the following formula: Among them, Q–V represents the phrase importance index, PMI-C represents the cosine mutual information value; The importance of knowledge entities is calculated based on the improved TextRank algorithm based on word vectors, including: Calculate the word vector for each knowledge entity; Calculating the Rank index of the knowledge entity according to the word vector and the improved TextRank algorithm, wherein the improved TextRank algorithm includes constructing a keyword network according to the knowledge entity, wherein the keyword network includes each keyword node in the network, directed and authorized edges between keywords determined according to the network construction scope, and the vector distance of the keywords; Calculate the inverse text frequency of each knowledge entity; Calculate the importance of knowledge entities according to the Rank index and the inverse text frequency; Determine the knowledge entity relationship based on the probability of occurrence and refinement of the knowledge entity, including: Traversing the text data to determine a document set corresponding to a knowledge entity; Calculating the probability of occurrence of a knowledge entity according to the document set corresponding to the knowledge entity; Calculate the knowledge entity refinement degree according to the occurrence probability of the knowledge entity; The knowledge entity relationship is determined according to the document set corresponding to the knowledge entity and the degree of refinement of the knowledge entity.
2. The method for extracting knowledge entities and relationships from text information according to claim 1, characterized in that: Also includes: Performing part-of-speech tagging on the knowledge entity; A knowledge entity database is constructed according to the knowledge entities, part-of-speech tagging results, phrase importance index, knowledge entity importance, and knowledge entity relationships.
3. A text quality assessment method, characterized in that: include: Obtain the knowledge entity importance and knowledge entity relationship calculated in claim 1; Constructing a text entity network diagram according to the knowledge entity relationship; Calculating the average degree, diameter, average path length and clustering coefficient according to the text entity network graph; The text quality is evaluated based on the average degree, diameter, average path length, clustering coefficient, and knowledge entity importance.
4. The text quality assessment method according to claim 3, characterized in that: The text quality is evaluated based on the average degree, diameter, average path length, clustering coefficient, and knowledge entity importance, including: Calculating the text topic focus according to the diameter and clustering coefficient; The quality of the text knowledge architecture is calculated based on the average degree, average path length, clustering coefficient and knowledge entity importance.
5. A device for extracting knowledge entities and relationships from text information, characterized in that: include: A text data acquisition module, used for acquiring text data; A knowledge entity extraction module, used to extract knowledge entities from the text data; An importance index calculation module, used to calculate the phrase importance index of the knowledge entity according to a mutual information algorithm; Importance calculation module, used to calculate the importance of knowledge entities according to the improved TextRank algorithm based on word vectors; A knowledge entity relationship determination module is used to determine the knowledge entity relationship according to the probability of occurrence and refinement of the knowledge entity; Calculating the phrase importance index of the knowledge entity according to the mutual information algorithm includes: Combine two knowledge entities among the extracted knowledge entities; Calculate the cosine mutual information value of the combined knowledge entity according to the mutual information algorithm; The phrase importance index of the combined knowledge entity is calculated according to the cosine mutual information value, and the phrase importance index is expressed by the following formula: Among them, Q–V represents the phrase importance index, PMI-C represents the cosine mutual information value; The importance of knowledge entities is calculated based on the improved TextRank algorithm based on word vectors, including: Calculate the word vector for each knowledge entity; Calculating the Rank index of the knowledge entity according to the word vector and the improved TextRank algorithm, wherein the improved TextRank algorithm includes constructing a keyword network according to the knowledge entity, wherein the keyword network includes each keyword node in the network, directed and authorized edges between keywords determined according to the network construction scope, and the vector distance of the keywords; Calculate the inverse text frequency of each knowledge entity; Calculate the importance of knowledge entities according to the Rank index and the inverse text frequency; Determine the knowledge entity relationship based on the probability of occurrence and refinement of the knowledge entity, including: Traversing the text data to determine a document set corresponding to a knowledge entity; Calculating the probability of occurrence of a knowledge entity according to the document set corresponding to the knowledge entity; Calculate the knowledge entity refinement degree according to the occurrence probability of the knowledge entity; The knowledge entity relationship is determined according to the document set corresponding to the knowledge entity and the degree of refinement of the knowledge entity.
6. A text quality assessment device, characterized in that: include: A data acquisition module, acquiring the knowledge entity importance and knowledge entity relationship calculated in claim 1; A network diagram construction module, used to construct a text entity network diagram according to the knowledge entity relationship; A parameter calculation module, used for calculating the average degree, diameter, average path length and clustering coefficient according to the text entity network graph; An evaluation module is used to evaluate the text quality according to the average degree, diameter, average path length, clustering coefficient and knowledge entity importance.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the knowledge entity and relationship extraction method of text information as described in claim 1 or 2 or the text quality assessment method as described in claim 3 or 4.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the knowledge entity and relationship extraction method of text information as described in claim 1 or 2 or the text quality assessment method as described in claim 3 or 4 by executing the computer instructions.
