CN111858950A - Method and device for expanding regular sentence pattern based on knowledge graph - Google Patents

Method and device for expanding regular sentence pattern based on knowledge graph Download PDF

Info

Publication number
CN111858950A
CN111858950A CN201910365372.7A CN201910365372A CN111858950A CN 111858950 A CN111858950 A CN 111858950A CN 201910365372 A CN201910365372 A CN 201910365372A CN 111858950 A CN111858950 A CN 111858950A
Authority
CN
China
Prior art keywords
regular
sentence pattern
regular sentence
semantic
nodes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910365372.7A
Other languages
Chinese (zh)
Inventor
魏誉荧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Genius Technology Co Ltd
Original Assignee
Guangdong Genius Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Genius Technology Co Ltd filed Critical Guangdong Genius Technology Co Ltd
Priority to CN201910365372.7A priority Critical patent/CN111858950A/en
Publication of CN111858950A publication Critical patent/CN111858950A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis

Abstract

The invention provides a method and a device for expanding regular sentence patterns based on a knowledge graph, which comprises the following steps: constructing a domain knowledge graph; obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes; and when the two regular sentences have an incidence relation, generating a new regular sentence according to the two regular sentences and the incidence relation. The invention generates new complex regular sentence patterns based on the incidence relation between the basic regular sentence patterns generated by the knowledge graph, can expand the existing regular sentence pattern library, and ensures that the constructed regular sentence pattern library is more perfect so as to accurately understand the intention of the user and improve the success rate of semantic analysis, thereby improving the user experience of intelligent learning products.

Description

Method and device for expanding regular sentence pattern based on knowledge graph
Technical Field
The invention relates to the field of semantic analysis, in particular to a method and a device for expanding regular sentence patterns based on a knowledge graph.
Background
With the continuous development of society, more and more intelligent learning equipment, such as family education machines, student's flat board etc. obtain wide application in the family. People use the equipment to assist children in learning, for example, when an undecipherable problem or an undecipherable knowledge point is encountered during learning, relevant questions or knowledge points are input through voice or text, and corresponding answers and knowledge explanation are searched in the intelligent learning equipment.
Currently, in a human-computer interaction scenario, accurate understanding of semantics of input information is the basis for making correct responses. Parsing semantics by means of regular expressions is a classic method in semantic parsing. The method improves the semantic parsing capability by expanding the regular expression library. Generally, the user corpora needs to be manually expanded, and the regular expression library is expanded according to the expanded corpora, so that time and labor are wasted, and the efficiency is low; in addition, there may be some corpora of the sentence patterns that are not collected, so that the constructed regular expression library is incomplete, and some corpora cannot be normally analyzed when the user uses the regular expression library, and further, the machine cannot accurately understand the intention of the user, and the use experience of the user is reduced.
Disclosure of Invention
The invention aims to provide a method and a device for expanding regular sentence patterns based on a knowledge graph, which can generate new complex regular sentence patterns based on the incidence relation between basic regular sentence patterns generated by the knowledge graph, expand the existing regular sentence pattern library, and improve the constructed regular sentence pattern library so as to accurately understand the intention of a user and improve the success rate of semantic analysis.
The technical scheme provided by the invention is as follows:
a method for expanding regular sentence patterns based on knowledge graph includes: constructing a domain knowledge graph; obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes; and when the two regular sentences have an incidence relation, generating a new regular sentence according to the two regular sentences and the incidence relation.
Further preferably, the obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes comprises: when the relationship between two adjacent nodes in the domain knowledge graph is a noun, obtaining a sentence-like expression according to the two nodes and the relationship, wherein the predicate of the sentence-like expression is a judgment verb; obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot; and in the sentence patterns, replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots to obtain corresponding regular sentence patterns.
Further preferably, the obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes further includes: when the relationship between two adjacent nodes in the domain knowledge graph is a verb, obtaining two types of sentences according to the two nodes and the relationship, wherein the predicates of the two types of sentences are the relationship; obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot; and in the two types of sentence patterns, replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots to obtain two corresponding types of regular sentence patterns.
Further preferably, when there is an association relationship between the two regular sentences, generating a new regular sentence according to the two regular sentences and the association relationship includes: when one regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of one regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, a replacement term is obtained according to the regular sentence pattern and replaces the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Further preferably, when there is an association relationship between the two regular sentence patterns, generating a new regular sentence pattern according to the two regular sentence patterns and the association relationship further includes: when one regular sentence pattern is two kinds of regular sentence patterns, and the tail semantic groove of one regular sentence pattern is the same as the head semantic groove of the other regular sentence pattern, obtaining a modification term according to the one regular sentence pattern, and modifying the head semantic groove of the other regular sentence pattern by the modification term to generate a new regular sentence pattern.
The invention also provides a device for expanding regular sentence patterns based on the knowledge graph, which comprises the following steps: the knowledge graph building module is used for building a domain knowledge graph; the basic regular sentence pattern generating module is used for obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes; and the complex regular sentence pattern generating module is used for generating a new regular sentence pattern according to the two regular sentence patterns and the incidence relation when the two regular sentence patterns have the incidence relation.
Further preferably, the substantially regular sentence generating module includes: a sentence pattern generation unit, configured to, when a relationship between two adjacent nodes in the domain knowledge graph is a noun, obtain a sentence pattern according to the two nodes and the relationship, where a predicate of the sentence pattern is a judgment verb; a semantic slot obtaining unit, configured to obtain a semantic slot corresponding to a head node in the two nodes, and mark the semantic slot as a head semantic slot; acquiring a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot; and the regular sentence pattern generating unit is used for replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots in the class of sentence patterns to obtain the corresponding class of regular sentence patterns.
Further preferably, the substantially regular sentence generating module further includes: the second-class sentence generating unit is used for obtaining a second-class sentence according to the two nodes and the relation when the relation between the two adjacent nodes in the domain knowledge graph is a verb, and the predicate of the second-class sentence is the relation; the regular sentence pattern generating unit is further configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the two kinds of sentence patterns to obtain two corresponding regular sentence patterns.
Preferably, the complex regular sentence pattern generating module is configured to, when one regular sentence pattern is a kind of regular sentence pattern and a tail semantic slot of the regular sentence pattern is the same as a head semantic slot of another regular sentence pattern, obtain a replacement term according to the regular sentence pattern, and replace the replacement term with the head semantic slot of another regular sentence pattern to generate a new regular sentence pattern.
Preferably, the complex regular sentence pattern generating module is further configured to, when one regular sentence pattern is two kinds of regular sentence patterns and a tail semantic groove of the one regular sentence pattern is the same as a head semantic groove of another regular sentence pattern, obtain a modification term according to the one regular sentence pattern, and modify the modification term with the head semantic groove of another regular sentence pattern to generate a new regular sentence pattern.
The method and the device for expanding the regular sentence pattern based on the knowledge graph can bring the following beneficial effects:
1. the invention generates new complex regular sentence patterns through the incidence relation between the basic regular sentence patterns generated based on the knowledge graph, expands the existing regular sentence pattern library, and ensures that the constructed regular sentence pattern library is more perfect so as to accurately understand the intention of the user and improve the success rate of semantic analysis, thereby improving the user experience of intelligent learning products.
2. The invention can automatically generate the regular sentence pattern without manually compiling the regular sentence pattern according to the rules deduced according to the meaning of the sentence, thereby not only saving the labor cost, but also having higher efficiency.
Drawings
The above features, technical features, advantages and implementations of a method and apparatus for expanding regular sentences based on knowledge-graphs will be further described in the following preferred embodiments in a clearly understandable manner with reference to the accompanying drawings.
FIG. 1 is a flow diagram of one embodiment of a method of expanding regular sentences based on a knowledge-graph of the present invention;
FIG. 2 is a flow diagram of another embodiment of a method of expanding regular sentences based on a knowledge-graph of the present invention;
FIG. 3 is a flow diagram of another embodiment of a method of expanding regular sentences based on a knowledge-graph of the present invention;
FIG. 4 is a flow diagram of another embodiment of a method of expanding regular sentences based on a knowledge-graph of the present invention;
FIG. 5 is a block diagram illustrating an embodiment of an apparatus for expanding regular sentence patterns based on knowledge-graphs according to the present invention;
FIG. 6 is a schematic diagram illustrating another embodiment of an apparatus for expanding regular sentence patterns based on knowledge-graphs according to the present invention;
FIG. 7 is a schematic diagram of another embodiment of an apparatus for expanding regular sentence pattern based on knowledge-graph according to the present invention.
The reference numbers illustrate:
100. the system comprises a knowledge graph construction module, a basic regular sentence pattern generation module 200, a complex regular sentence pattern generation module 300, a class I sentence pattern generation unit 210, a semantic groove acquisition unit 220, a regular sentence pattern generation unit 230 and a class II sentence pattern generation unit 240.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
The invention improves the success rate of semantic analysis by expanding regular sentence patterns; the method for expanding the regular sentence pattern provided by the invention can be applied to intelligent learning equipment (such as a family education machine), but a person skilled in the art can understand that the method for expanding the regular sentence pattern can also be applied to other intelligent learning equipment as long as the corresponding function can be realized.
In one embodiment of the present invention, as shown in fig. 1, a method for expanding regular sentence pattern based on knowledge graph includes:
step S100 constructs a domain knowledge graph.
Specifically, the knowledge graph visually describes concepts and complex relationships between entities in the objective world in a structured form. The knowledge graph is a network formed by nodes and node relations, concepts and entities in the objective world can be used as nodes in the knowledge graph, and for example, people, height, weight, geographic positions, literary works, movie works and the like can be used as nodes. The knowledge graph comprises nodes, relations and triples formed by the nodes and the relations, wherein each triplet represents a piece of knowledge, namely a certain relation or attribute exists between two nodes, and is represented by (head node, relation or attribute, tail node) (hereinafter, the triples are uniformly represented in this way), for example, (Hangzhou, located in China) represents a piece of knowledge that 'Hangzhou is located in China', and (apple, color, red) represents that 'the color of the apple is red'.
The domain knowledge maps comprise public domain knowledge maps, professional domain knowledge maps and subdivision domain knowledge maps. The professional field knowledge graph or the subdivided field knowledge graph has stronger pertinence and specialty, so the regular sentence pattern generated according to the professional field knowledge graph is more suitable for semantic analysis of the text of the corresponding professional field, and particularly for recognition and analysis of some professional terms, the success rate of the semantic analysis is higher. For example, for an intelligent learning product of a pupil, semantic recognition needs to be performed on the pupil's voice, and if a regular sentence pattern generated according to the pupil's educational knowledge map is used for semantic recognition and analysis, the pertinence is stronger.
Constructing a domain knowledge map, wherein a large amount of knowledge in the domain needs to be collected firstly, and the knowledge can be obtained from an existing knowledge base or network data and the like; then extracting concepts or entities from the acquired knowledge, and sorting the relationship among the concepts or the entities; each concept or entity is taken as a node, the relationship between the concepts or entities is taken as the relationship between the nodes, and all the nodes and the node relationship form the knowledge graph in the field.
Step S200, obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
Specifically, a regular sentence, i.e. a regular expression, is used to describe or match a series of character strings that conform to a certain syntactic rule. Every two adjacent nodes and the relation thereof in the domain knowledge graph form at least one triple, and each triple corresponds to at least one sentence pattern.
The semantic groove reflects a certain specific concept and can be a certain type of words; such as place name slot, which expresses the concept of place name, and all words representing place names are just one example thereof, such as Nanjing, Beijing, Hangzhou, etc. And replacing nodes in the sentence pattern by using the semantic slots, and generating the regular sentence pattern corresponding to the sentence pattern according to the original sentence pattern structure and the non-node part in the sentence pattern, wherein the non-node part in the sentence pattern reflects the relationship between the nodes. The semantic slots are used for replacing nodes, namely, a concept is used for replacing a specific entity, so that the semantic analysis capability of the regular sentence pattern can be improved, and the generalization capability of the regular sentence pattern can be improved.
For example, the node "hang state", the node "china" and the relation "located" constitute a triple (hang state, located in china), which means that "hang state is located in china", and a sentence pattern "hang state is located in china" can be obtained according to the meaning. Wherein, the node "Hangzhou" is replaced by a place name slot (representing words of place name), and the node "China" is replaced by a country name slot (representing words of country), so as to obtain a corresponding regular sentence pattern as follows: the # floor name slot # # [ is located in the ] # # national slot # #.
For example, the node "great," the node "great xian" and the relation "son" constitute a triple (great, son, great xian), meaning that "son of great is great mings," and a sentence "son of great is great mings" can be obtained based on the meaning. Wherein the nodes "Wangbangwei" and "Wangbaoming" are replaced by name slots (words representing names of people), and the regular sentence pattern is obtained as follows: the son of the # # # name well # # ] [ is the # # # name well # #.
From the above example, the main body of the regular sentence is composed of two semantic slots and words reflecting the relationship between the two semantic slots, and each triple in the knowledge graph is an example of the corresponding regular sentence.
In step S300, when there is an association relationship between two regular sentence patterns, a new regular sentence pattern is generated according to the two regular sentence patterns and the association relationship.
Specifically, if there are semantically identical parts of the bodies of two different regular sentences, such as semantically identical semantic slots, or semantically identical inter-slot relationships, it means that there is an association relationship between the two regular sentences. For example, regular sentence 1 corresponding to the triplet (wangming, father, wangwei) is: father of # name groove 1# # ] [ is ] # # name groove 2# #, and the regular sentence pattern 2 corresponding to the triplet (Wangwei, profession, doctor) is: the occupation of # name slot 3# # [ is ] # # occupation slot # #, and the name slot 3 of regular sentence pattern 2 has the same semantic as the name slot 2 of regular sentence pattern 1, and the same name slot can be used, which means that the two regular sentence patterns have an association relation.
And generating a new regular sentence pattern according to the two regular sentence patterns and the incidence relation thereof. Continuing with the above example, regular sentence pattern 1 and regular sentence pattern 2 have an association relationship, which can be seen more clearly from the relationship between two triples, so we can obtain a replacement term "father of the name slot 1" of "name slot 2" according to regular sentence pattern 1, and then replace the replacement term "name slot 3" of regular sentence pattern 2 according to the association relationship, thereby obtaining a new regular sentence pattern: the occupation of father ] [ of the # human name channel # #isthe # occupation channel # #.
In this embodiment, a basic regular sentence pattern is generated according to each triplet in the domain knowledge graph, then a new more complex regular sentence pattern is generated according to two basic regular sentence patterns having an association relationship, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more perfect, thereby accurately understanding the intention of a user, improving the success rate of semantic analysis, making a corresponding response, and further improving the user experience of an intelligent learning product.
In another embodiment of the present invention, as shown in FIG. 2, a method for expanding regular sentence based on knowledge-graph, comprises:
step S100 constructs a domain knowledge graph.
Step S200, obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
The step S200 includes:
step S210, when the relationship between two adjacent nodes in the domain knowledge graph is a noun, obtaining a sentence-like expression according to the two nodes and the relationship, wherein a predicate of the sentence-like expression is a judgment verb;
step S220, a semantic slot corresponding to a head node in the two nodes is obtained and recorded as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
step S230, in the class of sentence patterns, replacing the head node with the head semantic slot and replacing the tail node with the tail semantic slot to obtain a class of corresponding regular sentence patterns.
Specifically, when the relationship between two adjacent nodes is a noun, a sentence of the same type whose predicate is the judgment verb "yes" or the like can be generated from the two nodes and the relationship thereof.
For example, the node "great king," the node "small king," and the relation "son" constitute a triple (great king, son, small king), meaning that "son of great king is small king," or a sentence "son of great king is small king" can be obtained based on the meaning, and the verb sentence is a sentence "yes" or "yes", so the sentence is described as a class sentence. The nodes "great king" and "small king" in the sentence pattern are replaced by the name slots (words representing names of people), so that a regular sentence pattern is obtained: the son of the # name slot # # ] [ is the # name slot # #, or the son of the # name slot # # ] [ is the # name slot # #, the predicate of the regular sentence is the judgment verb "yes" or "yes", so the predicate is recorded as a kind of regular sentence.
For another example, the triple (apple, color, red) indicates "the color of apple is red", and a sentence "the color of apple is red" can be obtained according to the meaning, wherein the predicate is the judgment verb "yes", so the sentence is described as a class of sentence. Replacing the head node 'apple' with the head semantic groove 'fruit groove', and replacing the tail node 'red' with the tail semantic groove 'color groove', so as to obtain a regular sentence pattern: the color of the fruit groove # # ] [ is ] # # # # #, wherein the predicate is a judgment verb "yes" and is also a regular sentence pattern.
In a regular sentence pattern, because of the function of judging verb "yes" or "yes", the alternative item of the tail semantic groove can be obtained according to the relation or attribute added to the head semantic groove, i.e. the color of the "# # fruit groove # # can be used to replace the" # # color groove # # "in the semantic logic relation.
Step S310, when a regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of the regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, a replacement term is obtained according to the regular sentence pattern and replaces the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Specifically, when at least one regular sentence pattern is present in two regular sentence patterns having an association relationship, and the semantics of the tail semantic slot of the regular sentence pattern is the same as the semantics of the head semantic slot of another regular sentence pattern, a replacement term of the tail semantic slot is obtained according to the regular sentence pattern, and the replacement term is used to replace the head semantic slot of another regular sentence pattern, thereby obtaining a new more complex regular sentence pattern.
For example, regular sentence pattern 1: the father of # name groove 1# #is # # # name groove 2# #, which is a kind of regular sentence pattern; regular sentence pattern 2: the occupation of the # name groove 3# is # # # #, and is also a regular sentence pattern; the tail semantic slot of regular sentence pattern 1 has the same semantic as the head semantic slot of regular sentence pattern 2.
According to the regular sentence pattern 1, the replacement term of the name slot 2 is obtained as 'father of the name slot 1', in the regular sentence pattern 2, the replacement term is used for replacing the head semantic slot of the regular sentence pattern 2, and a new regular sentence pattern is obtained: the occupation of the father of the # human channel # is # occupation channel # #, and an example of adopting the new positive rule sentence pattern is "the occupation of the father of wang xiaoming is doctor".
In this embodiment, when two regular sentence patterns having an association relationship are both a kind of regular sentence patterns, a new regular sentence pattern is generated by using a replacement term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
In another embodiment of the present invention, as shown in FIG. 3, a method for expanding regular sentence based on knowledge-graph, comprises:
step S100 constructs a domain knowledge graph.
Step S200, obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes;
the step S200 includes:
step S210, when the relationship between two adjacent nodes in the domain knowledge graph is a noun, obtaining a sentence-like expression according to the two nodes and the relationship, wherein a predicate of the sentence-like expression is a judgment verb;
step S220, a semantic slot corresponding to a head node in the two nodes is obtained and recorded as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
step S230, in the class of sentence patterns, replacing the head node with the head semantic slot and replacing the tail node with the tail semantic slot to obtain a class of corresponding regular sentence patterns.
Step S240, when the relationship between two adjacent nodes in the domain knowledge graph is a verb, obtaining two types of sentences according to the two nodes and the relationship, wherein the predicates of the two types of sentences are the relationship;
step S250, obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
Step S260, in the two kinds of sentence patterns, the head semantic groove is used to replace the head node, and the tail semantic groove is used to replace the tail node, so as to obtain two kinds of corresponding regular sentence patterns.
Specifically, when the relationship between two adjacent nodes is a verb, two kinds of sentences can be generated from the two nodes and the relationship thereof, the two kinds of sentences using the relationship between the nodes as predicates.
For example, the node "wangxing", the node "football" and the relationship "like" form a triple (wangxing, like, football), which means "wangxing likes football", and a sentence "wangxing likes football" can be obtained according to the meaning, and the sentence adopts the relationship "like" as a predicate, so the sentence is denoted as a second-class sentence. The regular sentence pattern is obtained by replacing the node 'wangxing' in the sentence pattern with the name slot (the words representing the name of the person), and replacing the node 'football' with the ball game slot: the # # -name slot # # [ likes ] # # ball sports slot # #, and the regularized sentence adopts the relation "like" as a predicate, so that the sentence is recorded as a second type of regularized sentence.
Step S310, when a regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of the regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, a replacement term is obtained according to the regular sentence pattern and replaces the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Specifically, when at least one regular sentence pattern is present in two regular sentence patterns having an association relationship, and the semantics of the tail semantic slot of the regular sentence pattern is the same as the semantics of the head semantic slot of another regular sentence pattern, a replacement term of the tail semantic slot is obtained according to the regular sentence pattern, and the replacement term is used to replace the head semantic slot of another regular sentence pattern, thereby obtaining a new more complex regular sentence pattern.
For example, from the triplet (# -contest, first-prize winner, wang-mingming), regular sentence pattern 1 is derived: the first-grade prize obtainer of the # competition name slot # # ] [ is the # name slot # #, and is a regular sentence pattern;
from the triplet (wangming, liking, football), we get regular sentence pattern 2: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
the tail semantic slot of the regular sentence pattern 1 has the same semantic meaning as the head semantic slot of the regular sentence pattern 2, so that the regular sentence pattern 1 and the regular sentence pattern 2 have an association relation.
According to the regular sentence pattern 1, the alternative term of the 'name slot' is the first-class prize obtainer of the '# # # competition name slot # #', in the regular sentence pattern 2, the alternative term is used for replacing the head semantic slot of the regular sentence pattern 2 to obtain a new regular sentence pattern: an example of a pattern employing the new positive rule is ". sub.a first prize winner of contest # slot # # ########### - # -like ball game slot # #".
In this embodiment, when two regular sentence patterns having an association relationship exist, one of the two regular sentence patterns is a class of regular sentence pattern, and the other is a class of regular sentence pattern, a new regular sentence pattern is generated by using a replacement term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
In another embodiment of the present invention, as shown in FIG. 4, a method for expanding regular sentence based on knowledge-graph, comprises:
step S100 constructs a domain knowledge graph.
Step S200, obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes;
step S210, when the relationship between two adjacent nodes in the domain knowledge graph is a noun, obtaining a sentence-like expression according to the two nodes and the relationship, wherein a predicate of the sentence-like expression is a judgment verb;
step S220, a semantic slot corresponding to a head node in the two nodes is obtained and recorded as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
step S230, in the class of sentence patterns, replacing the head node with the head semantic slot and replacing the tail node with the tail semantic slot to obtain a class of corresponding regular sentence patterns.
Step S240, when the relationship between two adjacent nodes in the domain knowledge graph is a verb, obtaining two types of sentences according to the two nodes and the relationship, wherein the predicates of the two types of sentences are the relationship;
step S250, obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot; obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
step S260, in the two kinds of sentence patterns, the head semantic groove is used to replace the head node, and the tail semantic groove is used to replace the tail node, so as to obtain two kinds of corresponding regular sentence patterns.
Step S310, when a regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of the regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, a replacement term is obtained according to the regular sentence pattern and replaces the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Step S320, when one regular sentence pattern is two kinds of regular sentence patterns, and the tail semantic groove of the one regular sentence pattern is the same as the head semantic groove of the other regular sentence pattern, obtaining a modification term according to the one regular sentence pattern, and modifying the modification term with the head semantic groove of the other regular sentence pattern to generate a new regular sentence pattern.
Specifically, when two regular sentence patterns with an association relation have two regular sentence patterns, and the tail semantic groove of the two regular sentence patterns is the same as the head semantic groove of another regular sentence pattern, a modification term is obtained according to the two regular sentence patterns, and the head semantic groove of another regular sentence pattern is modified by the modification term, so that a new more complex regular sentence pattern is obtained.
For example, from a triplet (wang xiaoming, like, football), regular sentence pattern 1 is obtained: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
from the triplet (football, origin, china), we get regular sentence pattern 2: the origin of the # ball sport groove # # ] [ is the # national groove # #, which is a kind of regular sentence pattern;
the tail semantic slot of the regular sentence pattern 1 has the same semantic meaning as the head semantic slot of the regular sentence pattern 2, so that the regular sentence pattern 1 and the regular sentence pattern 2 have an association relation.
According to the regular sentence pattern 1, the modification term of the 'ball game groove' is '# # # name groove # # [ favorite ]', in the regular sentence pattern 2, the modification term is used for modifying the head semantic groove of the regular sentence pattern 2 to obtain a new regular sentence pattern: the origin of the # name groove # # # # # # # # # favorite ball sports groove # # ] [ is the # national groove # # ], and an example adopting the new positive rule sentence pattern is that the origin of the Wangxingming favorite football is China.
For another example, from a triplet (wangxue, like, football), regular sentence pattern 1 is obtained: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
from the triplet (football, origin, China), we get regular sentence pattern 2: the # ball sport groove # # [ origin ] # # # # national groove # #isa two-class regular sentence pattern;
according to the regular sentence pattern 1, the modification term of the 'ball game groove' is '# # # name groove # # [ favorite ]', in the regular sentence pattern 2, the modification term is used for modifying the head semantic groove of the regular sentence pattern 2 to obtain a new regular sentence pattern: an example of the sentence pattern adopting the new positive rule is 'Wangxueming favorite football China'.
The new regular sentence patterns can be classified into a first-class sentence pattern and a second-class sentence pattern according to the predicates of the sentence patterns, an association relationship may exist between the new regular sentence patterns and the basic regular sentence patterns (the basic regular sentence patterns are the regular sentence patterns obtained according to the triples in the knowledge graph) or between the new regular sentence patterns and the new regular sentence patterns, and the two regular sentence patterns with the association relationship can generate the new regular sentence patterns by replacing terms or modifying terms.
The embodiment also provides a method for generating a new regular sentence pattern by using a modification term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
In one embodiment of the present invention, as shown in fig. 5, an apparatus for expanding regular sentence pattern based on knowledge graph comprises:
and the knowledge graph building module 100 is used for building the domain knowledge graph.
Specifically, the knowledge graph visually describes concepts and complex relationships between entities in the objective world in a structured form. The knowledge graph is a network formed by nodes and node relations, concepts and entities in the objective world can be used as nodes in the knowledge graph, and for example, people, height, weight, geographic positions, literary works, movie works and the like can be used as nodes. The knowledge graph comprises nodes, relations and triples formed by the nodes and the relations, wherein each triplet represents a piece of knowledge, namely a certain relation or attribute exists between two nodes, and is represented by (head node, relation or attribute, tail node) (hereinafter, the triples are uniformly represented in this way), for example, (Hangzhou, located in China) represents a piece of knowledge that 'Hangzhou is located in China', and (apple, color, red) represents that 'the color of the apple is red'.
The domain knowledge maps comprise public domain knowledge maps, professional domain knowledge maps and subdivision domain knowledge maps. The professional field knowledge graph or the subdivided field knowledge graph has stronger pertinence and specialty, so the regular sentence pattern generated according to the professional field knowledge graph is more suitable for semantic analysis of the text of the corresponding professional field, and particularly for recognition and analysis of some professional terms, the success rate of the semantic analysis is higher. For example, for an intelligent learning product of a pupil, semantic recognition needs to be performed on the pupil's voice, and if a regular sentence pattern generated according to the pupil's educational knowledge map is used for semantic recognition and analysis, the pertinence is stronger.
Constructing a domain knowledge map, wherein a large amount of knowledge in the domain needs to be collected firstly, and the knowledge can be obtained from an existing knowledge base or network data and the like; then extracting concepts or entities from the acquired knowledge, and sorting the relationship among the concepts or the entities; each concept or entity is taken as a node, the relationship between the concepts or entities is taken as the relationship between the nodes, and all the nodes and the node relationship form the knowledge graph in the field.
And a basic regular sentence pattern generating module 200, configured to obtain a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
Specifically, a regular sentence, i.e. a regular expression, is used to describe or match a series of character strings that conform to a certain syntactic rule.
Every two adjacent nodes and the relation thereof in the domain knowledge graph form at least one triple, and each triple corresponds to at least one sentence pattern.
The semantic groove reflects a certain specific concept and can be a certain type of words; such as place name slot, which expresses the concept of place name, and all words representing place names are just one example thereof, such as Nanjing, Beijing, Hangzhou, etc. And replacing nodes in the sentence pattern by using the semantic slots, and generating the regular sentence pattern corresponding to the sentence pattern according to the original sentence pattern structure and the non-node part in the sentence pattern, wherein the non-node part in the sentence pattern reflects the relationship between the nodes. The semantic slots are used for replacing nodes, namely, a concept is used for replacing a specific entity, so that the semantic analysis capability of the regular sentence pattern can be improved, and the generalization capability of the regular sentence pattern can be improved.
For example, the node "hang state", the node "china" and the relation "located" constitute a triple (hang state, located in china), which means that "hang state is located in china", and a sentence pattern "hang state is located in china" can be obtained according to the meaning. Wherein, the node "Hangzhou" is replaced by a place name slot (representing words of place name), and the node "China" is replaced by a country name slot (representing words of country), so as to obtain a corresponding regular sentence pattern as follows: the # floor name slot # # [ is located in the ] # # national slot # #.
For example, the node "great," the node "great xian" and the relation "son" constitute a triple (great, son, great xian), meaning that "son of great is great mings," and a sentence "son of great is great mings" can be obtained based on the meaning. Wherein the nodes "Wangbangwei" and "Wangbaoming" are replaced by name slots (words representing names of people), and the regular sentence pattern is obtained as follows: the son of the # # # name well # # ] [ is the # # # name well # #.
From the above example, the main body of the regular sentence is composed of two semantic slots and words reflecting the relationship between the two semantic slots, and each triple in the knowledge graph is an example of the corresponding regular sentence.
And a complex regular sentence pattern generating module 300, configured to, when one regular sentence pattern is a kind of regular sentence pattern and a tail semantic slot of the regular sentence pattern is the same as a head semantic slot of another regular sentence pattern, obtain a replacement term according to the regular sentence pattern, and replace the head semantic slot of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Specifically, if there are semantically identical parts of the bodies of two different regular sentences, such as semantically identical semantic slots, or semantically identical inter-slot relationships, it means that there is an association relationship between the two regular sentences. For example, regular sentence 1 corresponding to the triplet (wangming, father, wangwei) is: father of # name groove 1# # ] [ is ] # # name groove 2# #, and the regular sentence pattern 2 corresponding to the triplet (Wangwei, profession, doctor) is: the occupation of # name slot 3# # [ is ] # # occupation slot # #, and the name slot 3 of regular sentence pattern 2 has the same semantic as the name slot 2 of regular sentence pattern 1, and the same name slot can be used, which means that the two regular sentence patterns have an association relation.
And generating a new regular sentence pattern according to the two regular sentence patterns and the incidence relation thereof. Continuing with the above example, regular sentence pattern 1 and regular sentence pattern 2 have an association relationship, which can be seen more clearly from the relationship between two triples, so we can obtain a replacement term "father of the name slot 1" of "name slot 2" according to regular sentence pattern 1, and then replace the replacement term "name slot 3" of regular sentence pattern 2 according to the association relationship, thereby obtaining a new regular sentence pattern: the occupation of father ] [ of the # human name channel # #isthe # occupation channel # #.
In this embodiment, a basic regular sentence pattern is generated according to each triplet in the domain knowledge graph, then a new more complex regular sentence pattern is generated according to two basic regular sentence patterns having an association relationship, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more perfect, thereby accurately understanding the intention of a user, improving the success rate of semantic analysis, making a corresponding response, and further improving the user experience of an intelligent learning product.
In another embodiment of the present invention, as shown in fig. 6, an apparatus for expanding regular sentence based on knowledge-graph, comprises:
and the knowledge graph building module 100 is used for building the domain knowledge graph.
And a basic regular sentence pattern generating module 200, configured to obtain a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
The substantially regular sentence generating module 200 includes:
a class sentence pattern generating unit 210, configured to obtain a class sentence pattern according to the two nodes and the relationship when the relationship between two adjacent nodes in the domain knowledge graph is a noun, where a predicate of the class sentence pattern is a judgment verb;
a semantic slot obtaining unit 220, configured to obtain a semantic slot corresponding to a head node in the two nodes, and record the semantic slot as a head semantic slot; acquiring a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
The regular sentence pattern generating unit 230 is configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the class of sentence patterns to obtain a corresponding class of regular sentence patterns.
Specifically, when the relationship between two adjacent nodes is a noun, a sentence of the same type whose predicate is the judgment verb "yes" or the like can be generated from the two nodes and the relationship thereof.
For example, the node "great king," the node "small king," and the relation "son" constitute a triple (great king, son, small king), meaning that "son of great king is small king," or a sentence "son of great king is small king" can be obtained based on the meaning, and the verb sentence is a sentence "yes" or "yes", so the sentence is described as a class sentence. The nodes "great king" and "small king" in the sentence pattern are replaced by the name slots (words representing names of people), so that a regular sentence pattern is obtained: the son of the # name slot # # ] [ is the # name slot # #, or the son of the # name slot # # ] [ is the # name slot # #, the predicate of the regular sentence is the judgment verb "yes" or "yes", so the predicate is recorded as a kind of regular sentence.
For another example, the triple (apple, color, red) indicates "the color of apple is red", and a sentence "the color of apple is red" can be obtained according to the meaning, wherein the predicate is the judgment verb "yes", so the sentence is described as a class of sentence. Replacing the head node 'apple' with the head semantic groove 'fruit groove', and replacing the tail node 'red' with the tail semantic groove 'color groove', so as to obtain a regular sentence pattern: the color of the fruit groove # # ] [ is ] # # # # #, wherein the predicate is a judgment verb "yes" and is also a regular sentence pattern.
In a regular sentence pattern, because of the function of judging verb "yes" or "yes", the alternative item of the tail semantic groove can be obtained according to the relation or attribute added to the head semantic groove, i.e. the color of the "# # fruit groove # # can be used to replace the" # # color groove # # "in the semantic logic relation.
And a complex regular sentence pattern generating module 300, configured to, when one regular sentence pattern is a kind of regular sentence pattern and a tail semantic slot of the regular sentence pattern is the same as a head semantic slot of another regular sentence pattern, obtain a replacement term according to the regular sentence pattern, and replace the head semantic slot of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Specifically, when at least one regular sentence pattern is present in two regular sentence patterns having an association relationship, and the semantics of the tail semantic slot of the regular sentence pattern is the same as the semantics of the head semantic slot of another regular sentence pattern, a replacement term of the tail semantic slot is obtained according to the regular sentence pattern, and the replacement term is used to replace the head semantic slot of another regular sentence pattern, thereby obtaining a new more complex regular sentence pattern.
For example, regular sentence pattern 1: the father of # name groove 1# #is # # # name groove 2# #, which is a kind of regular sentence pattern; regular sentence pattern 2: the occupation of the # name groove 3# is # # # #, and is also a regular sentence pattern; the tail semantic slot of regular sentence pattern 1 has the same semantic as the head semantic slot of regular sentence pattern 2.
According to the regular sentence pattern 1, the replacement term of the name slot 2 is obtained as 'father of the name slot 1', in the regular sentence pattern 2, the replacement term is used for replacing the head semantic slot of the regular sentence pattern 2, and a new regular sentence pattern is obtained: the occupation of the father of the # human channel # is # occupation channel # #, and an example of adopting the new positive rule sentence pattern is "the occupation of the father of wang xiaoming is doctor".
In this embodiment, when two regular sentence patterns having an association relationship are both a kind of regular sentence patterns, a new regular sentence pattern is generated by using a replacement term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
In another embodiment of the present invention, as shown in fig. 7, an apparatus for expanding regular sentence based on knowledge-graph, comprises:
and the knowledge graph building module 100 is used for building the domain knowledge graph.
And a basic regular sentence pattern generating module 200, configured to obtain a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
The substantially regular sentence generating module 200 includes:
a class sentence pattern generating unit 210, configured to obtain a class sentence pattern according to the two nodes and the relationship when the relationship between two adjacent nodes in the domain knowledge graph is a noun, where a predicate of the class sentence pattern is a judgment verb;
a semantic slot obtaining unit 220, configured to obtain a semantic slot corresponding to a head node in the two nodes, and record the semantic slot as a head semantic slot; acquiring a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
the regular sentence pattern generating unit 230 is configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the class of sentence patterns to obtain a corresponding class of regular sentence patterns.
A class-II sentence generating unit 240, configured to, when a relationship between two adjacent nodes in the domain knowledge graph is a verb, obtain a class-II sentence according to the two nodes and the relationship, where a predicate of the class-II sentence is the relationship;
The regular sentence pattern generating unit 230 is further configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the two kinds of sentence patterns to obtain two corresponding regular sentence patterns.
Specifically, when the relationship between two adjacent nodes is a verb, two kinds of sentences can be generated from the two nodes and the relationship thereof, the two kinds of sentences using the relationship between the nodes as predicates.
For example, the node "wangxing", the node "football" and the relationship "like" form a triple (wangxing, like, football), which means "wangxing likes football", and a sentence "wangxing likes football" can be obtained according to the meaning, and the sentence adopts the relationship "like" as a predicate, so the sentence is denoted as a second-class sentence. The regular sentence pattern is obtained by replacing the node 'wangxing' in the sentence pattern with the name slot (the words representing the name of the person), and replacing the node 'football' with the ball game slot: the # # -name slot # # [ likes ] # # ball sports slot # #, and the regularized sentence adopts the relation "like" as a predicate, so that the sentence is recorded as a second type of regularized sentence.
And a complex regular sentence pattern generating module 300, configured to, when one regular sentence pattern is a kind of regular sentence pattern and a tail semantic slot of the regular sentence pattern is the same as a head semantic slot of another regular sentence pattern, obtain a replacement term according to the regular sentence pattern, and replace the head semantic slot of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
Specifically, when at least one regular sentence pattern is present in two regular sentence patterns having an association relationship, and the semantics of the tail semantic slot of the regular sentence pattern is the same as the semantics of the head semantic slot of another regular sentence pattern, a replacement term of the tail semantic slot is obtained according to the regular sentence pattern, and the replacement term is used to replace the head semantic slot of another regular sentence pattern, thereby obtaining a new more complex regular sentence pattern.
For example, from the triplet (# -contest, first-prize winner, wang-mingming), regular sentence pattern 1 is derived: the first-grade prize obtainer of the # competition name slot # # ] [ is the # name slot # #, and is a regular sentence pattern;
from the triplet (wangming, liking, football), we get regular sentence pattern 2: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
the tail semantic slot of the regular sentence pattern 1 has the same semantic meaning as the head semantic slot of the regular sentence pattern 2, so that the regular sentence pattern 1 and the regular sentence pattern 2 have an association relation.
According to the regular sentence pattern 1, the alternative term of the 'name slot' is the first-class prize obtainer of the '# # # competition name slot # #', in the regular sentence pattern 2, the alternative term is used for replacing the head semantic slot of the regular sentence pattern 2 to obtain a new regular sentence pattern: an example of a pattern employing the new positive rule is ". sub.a first prize winner of contest # slot # # ########### - # -like ball game slot # #".
In this embodiment, when two regular sentence patterns having an association relationship exist, one of the two regular sentence patterns is a class of regular sentence pattern, and the other is a class of regular sentence pattern, a new regular sentence pattern is generated by using a replacement term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
In another embodiment of the present invention, as shown in fig. 7, an apparatus for expanding regular sentence based on knowledge-graph, comprises:
a knowledge graph construction module 100 for constructing a domain knowledge graph;
and a basic regular sentence pattern generating module 200, configured to obtain a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes.
The substantially regular sentence generating module 200 includes:
a class sentence pattern generating unit 210, configured to obtain a class sentence pattern according to the two nodes and the relationship when the relationship between two adjacent nodes in the domain knowledge graph is a noun, where a predicate of the class sentence pattern is a judgment verb;
a semantic slot obtaining unit 220, configured to obtain a semantic slot corresponding to a head node in the two nodes, and record the semantic slot as a head semantic slot; acquiring a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
The regular sentence pattern generating unit 230 is configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the class of sentence patterns to obtain a corresponding class of regular sentence patterns.
A class-II sentence generating unit 240, configured to, when a relationship between two adjacent nodes in the domain knowledge graph is a verb, obtain a class-II sentence according to the two nodes and the relationship, where a predicate of the class-II sentence is the relationship;
the regular sentence pattern generating unit 230 is further configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the two kinds of sentence patterns to obtain two corresponding regular sentence patterns.
A complex regular sentence pattern generating module 300, configured to, when one regular sentence pattern is a kind of regular sentence pattern and a tail semantic groove of the regular sentence pattern is the same as a head semantic groove of another regular sentence pattern, obtain a replacement term according to the regular sentence pattern, and replace the replacement term with the head semantic groove of another regular sentence pattern to generate a new regular sentence pattern; and when one regular sentence pattern is two kinds of regular sentence patterns, and the tail semantic groove of one regular sentence pattern is the same as the head semantic groove of the other regular sentence pattern, obtaining a modification term according to the one regular sentence pattern, and modifying the head semantic groove of the other regular sentence pattern by the modification term to generate a new regular sentence pattern.
Specifically, when two regular sentence patterns with an association relation have two regular sentence patterns, and the tail semantic groove of the two regular sentence patterns is the same as the head semantic groove of another regular sentence pattern, a modification term is obtained according to the two regular sentence patterns, and the head semantic groove of another regular sentence pattern is modified by the modification term, so that a new more complex regular sentence pattern is obtained.
For example, from a triplet (wang xiaoming, like, football), regular sentence pattern 1 is obtained: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
from the triplet (football, origin, china), we get regular sentence pattern 2: the origin of the # ball sport groove # # ] [ is the # national groove # #, which is a kind of regular sentence pattern;
the tail semantic slot of the regular sentence pattern 1 has the same semantic meaning as the head semantic slot of the regular sentence pattern 2, so that the regular sentence pattern 1 and the regular sentence pattern 2 have an association relation.
According to the regular sentence pattern 1, the modification term of the 'ball game groove' is '# # # name groove # # [ favorite ]', in the regular sentence pattern 2, the modification term is used for modifying the head semantic groove of the regular sentence pattern 2 to obtain a new regular sentence pattern: the origin of the # name groove # # # # # # # # # favorite ball sports groove # # ] [ is the # national groove # # ], and an example adopting the new positive rule sentence pattern is that the origin of the Wangxingming favorite football is China.
For another example, from a triplet (wangxue, like, football), regular sentence pattern 1 is obtained: the # name groove # # [ likes ] # # ball sports groove # #, which is a two-class regular sentence pattern;
from the triplet (football, origin, China), we get regular sentence pattern 2: the # ball sport groove # # [ origin ] # # # # national groove # #isa two-class regular sentence pattern;
according to the regular sentence pattern 1, the modification term of the 'ball game groove' is '# # # name groove # # [ favorite ]', in the regular sentence pattern 2, the modification term is used for modifying the head semantic groove of the regular sentence pattern 2 to obtain a new regular sentence pattern: an example of the sentence pattern adopting the new positive rule is 'Wangxueming favorite football China'.
The new regular sentence patterns can be classified into a first-class sentence pattern and a second-class sentence pattern according to the predicates of the sentence patterns, an association relationship may exist between the new regular sentence patterns and the basic regular sentence patterns (the basic regular sentence patterns are the regular sentence patterns obtained according to the triples in the knowledge graph) or between the new regular sentence patterns and the new regular sentence patterns, and the two regular sentence patterns with the association relationship can generate the new regular sentence patterns by replacing terms or modifying terms.
The embodiment also provides a method for generating a new regular sentence pattern by using a modification term, and the existing regular sentence pattern library is expanded, so that the constructed regular sentence pattern library is more complete.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for expanding regular sentence patterns based on knowledge graph is characterized by comprising the following steps:
constructing a domain knowledge graph;
obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes;
and when the two regular sentences have an incidence relation, generating a new regular sentence according to the two regular sentences and the incidence relation.
2. The method of claim 1, wherein obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and their relationship comprises:
when the relationship between two adjacent nodes in the domain knowledge graph is a noun, obtaining a sentence-like expression according to the two nodes and the relationship, wherein the predicate of the sentence-like expression is a judgment verb;
Obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot;
obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
and in the sentence patterns, replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots to obtain corresponding regular sentence patterns.
3. The method of claim 2, wherein obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and their relationship further comprises:
when the relationship between two adjacent nodes in the domain knowledge graph is a verb, obtaining two types of sentences according to the two nodes and the relationship, wherein the predicates of the two types of sentences are the relationship;
obtaining a semantic slot corresponding to a head node in the two nodes, and recording the semantic slot as a head semantic slot;
obtaining a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
and in the two types of sentence patterns, replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots to obtain two corresponding types of regular sentence patterns.
4. The method of claim 1, wherein when two regular sentences have an association relationship, generating a new regular sentence according to the two regular sentences and the association relationship comprises:
When one regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of one regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, a replacement term is obtained according to the regular sentence pattern and replaces the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
5. The method of claim 4, wherein when there is an association between two regular sentence patterns, generating a new regular sentence pattern according to the two regular sentence patterns and the association further comprises:
when one regular sentence pattern is two kinds of regular sentence patterns, and the tail semantic groove of one regular sentence pattern is the same as the head semantic groove of the other regular sentence pattern, obtaining a modification term according to the one regular sentence pattern, and modifying the head semantic groove of the other regular sentence pattern by the modification term to generate a new regular sentence pattern.
6. An apparatus for expanding regular sentence patterns based on knowledge graph, comprising:
the knowledge graph building module is used for building a domain knowledge graph;
the basic regular sentence pattern generating module is used for obtaining a regular sentence pattern according to every two adjacent nodes in the domain knowledge graph and the relationship between the two adjacent nodes;
And the complex regular sentence pattern generating module is used for generating a new regular sentence pattern according to the two regular sentence patterns and the incidence relation when the two regular sentence patterns have the incidence relation.
7. The apparatus of claim 6, wherein the generating module of the basic regular sentence pattern comprises:
a sentence pattern generation unit, configured to, when a relationship between two adjacent nodes in the domain knowledge graph is a noun, obtain a sentence pattern according to the two nodes and the relationship, where a predicate of the sentence pattern is a judgment verb;
a semantic slot obtaining unit, configured to obtain a semantic slot corresponding to a head node in the two nodes, and mark the semantic slot as a head semantic slot; acquiring a semantic slot corresponding to a tail node in the two nodes, and recording the semantic slot as a tail semantic slot;
and the regular sentence pattern generating unit is used for replacing the head nodes with the head semantic slots and replacing the tail nodes with the tail semantic slots in the class of sentence patterns to obtain the corresponding class of regular sentence patterns.
8. The apparatus of claim 7, wherein the generating module of basic regular sentence pattern further comprises:
The second-class sentence generating unit is used for obtaining a second-class sentence according to the two nodes and the relation when the relation between the two adjacent nodes in the domain knowledge graph is a verb, and the predicate of the second-class sentence is the relation;
the regular sentence pattern generating unit is further configured to replace the head node with the head semantic slot and replace the tail node with the tail semantic slot in the two kinds of sentence patterns to obtain two corresponding regular sentence patterns.
9. The apparatus of claim 6, wherein the regular sentence pattern is extended based on knowledge-graph, and the apparatus comprises:
and the complex regular sentence pattern generating module is used for obtaining a replacement term according to one regular sentence pattern when the regular sentence pattern is a kind of regular sentence pattern and the tail semantic groove of the regular sentence pattern is the same as the head semantic groove of another regular sentence pattern, and replacing the head semantic groove of another regular sentence pattern with the replacement term to generate a new regular sentence pattern.
10. The apparatus of claim 9, wherein the regular sentence is extended based on knowledge-graph, and the apparatus comprises:
and the complex regular sentence pattern generating module is further used for obtaining a modification item according to one regular sentence pattern when the regular sentence pattern is two kinds of regular sentence patterns and the tail semantic groove of the regular sentence pattern is the same as the head semantic groove of the other regular sentence pattern, and modifying the modification item with the head semantic groove of the other regular sentence pattern to generate a new regular sentence pattern.
CN201910365372.7A 2019-04-30 2019-04-30 Method and device for expanding regular sentence pattern based on knowledge graph Pending CN111858950A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910365372.7A CN111858950A (en) 2019-04-30 2019-04-30 Method and device for expanding regular sentence pattern based on knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910365372.7A CN111858950A (en) 2019-04-30 2019-04-30 Method and device for expanding regular sentence pattern based on knowledge graph

Publications (1)

Publication Number Publication Date
CN111858950A true CN111858950A (en) 2020-10-30

Family

ID=72966680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910365372.7A Pending CN111858950A (en) 2019-04-30 2019-04-30 Method and device for expanding regular sentence pattern based on knowledge graph

Country Status (1)

Country Link
CN (1) CN111858950A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090061844A (en) * 2007-12-12 2009-06-17 주식회사 케이티 System and method for extracting semantic metadata based on ontology
CN106777274A (en) * 2016-06-16 2017-05-31 北京理工大学 A kind of Chinese tour field knowledge mapping construction method and system
CN107609052A (en) * 2017-08-23 2018-01-19 中国科学院软件研究所 A kind of generation method and device of the domain knowledge collection of illustrative plates based on semantic triangle

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090061844A (en) * 2007-12-12 2009-06-17 주식회사 케이티 System and method for extracting semantic metadata based on ontology
CN106777274A (en) * 2016-06-16 2017-05-31 北京理工大学 A kind of Chinese tour field knowledge mapping construction method and system
CN107609052A (en) * 2017-08-23 2018-01-19 中国科学院软件研究所 A kind of generation method and device of the domain knowledge collection of illustrative plates based on semantic triangle

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
杨帅;宋汝良;: "面向知识扩充的实体关系挖掘", 电脑知识与技术, no. 01 *
杨玉基;许斌;胡家威;仝美涵;张鹏;郑莉;: "一种准确而高效的领域知识图谱构建方法", 软件学报, no. 10 *

Similar Documents

Publication Publication Date Title
Diessel The grammar network
Walsh et al. Multilevel exemplar theory
US8478581B2 (en) Interlingua, interlingua engine, and interlingua machine translation system
CN106844658A (en) A kind of Chinese text knowledge mapping method for auto constructing and system
US20150331850A1 (en) System for semantic interpretation
CN110427478B (en) Knowledge graph-based question and answer searching method and system
US20070112554A1 (en) System of interactive dictionary
Curto et al. Question generation based on lexico-syntactic patterns learned from the web
Mirkovic et al. Where does gender come from? Evidence from a complex inflectional system
CN111767385A (en) Intelligent question and answer method and device
Riegel The language acquisition process: A reinterpretation of selected research findings
KR102146433B1 (en) Method for providing context based language learning service using associative memory
CN112149427A (en) Method for constructing verb phrase implication map and related equipment
Schank A conceptual dependency representation for a computer-oriented semantics
van Rij Pronoun processing: Computational, behavioral, and psychophysiological studies in children and adults
Reiter Discovering Structural Similarities in Narrative Texts using Event Alignment Algorithms
Hoffmann The cognitive foundation of post-colonial Englishes: Construction grammar as the cognitive theory for the dynamic model
Sharp et al. Cognitive approach to natural language processing
Michelbacher Multi-word tokenization for natural language processing
Louis Predicting text quality: metrics for content, organization and reader interest
CN111858950A (en) Method and device for expanding regular sentence pattern based on knowledge graph
JP2008310784A (en) Interaction device using semantic network as base, interaction program, and recording medium recording interaction program
Van Dyke Word prediction for disabled users: Applying natural language processing to enhance communication
CN112732885A (en) Answer extension method and device for question-answering system and electronic equipment
FRANCO Vocabulary selection and organization for augmentative and alternative communication of children with speech impairment

Legal Events

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