A method and apparatus for querying knowledge graphs of sensitive personal information
By correcting errors and constructing specific formats from user-input query text, and combining this with deep semantic parsing technology to generate Cypher query statements, the problem that general methods cannot query knowledge graphs of sensitive personal information is solved, enabling intelligent and convenient multi-scenario queries and privacy protection.
Patent Information
- Application Number
- CN202211630159.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-13
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-12-13
AI Technical Summary
Existing general knowledge graph query methods cannot efficiently and conveniently query knowledge graphs containing sensitive personal information, and cannot effectively protect personal privacy information.
This paper provides a method for querying knowledge graphs of sensitive personal information, including text error correction, construction of specific input formats, text information recognition, generation and splicing of query statement fragments, automatic generation of Cypher query statements using deep semantic parsing technology, and intelligent analysis combined with user query scenarios.
It enables intelligent queries in multiple scenarios without the need for manual template addition, reducing the difficulty of use for users, alleviating development difficulties, and protecting sensitive personal information.
Smart Images

Figure CN116127013B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of knowledge graph, in particular to a personal sensitive information knowledge graph query method and device. BACKGROUND
[0002] Unlike general knowledge graphs, the sensitivity of information in personal sensitive information knowledge graphs is usually closely related to the information source scene. For example, users are willing to actively display personal portrait information in social media scenarios, but in financial lending scenarios, personal portraits are an important privacy information that users want to protect.
[0003] Due to the scene dependence of personal sensitive information knowledge graphs, general knowledge graph query methods are not suitable for querying personal sensitive information knowledge graphs. How to efficiently and conveniently query the knowledge contained in personal sensitive information knowledge graphs and help people protect personal sensitive information has become a research difficulty, and an innovative method is urgently needed to help solve the problem. SUMMARY
[0004] The present application provides a personal sensitive information knowledge graph query method and device for querying personal sensitive information knowledge graphs. The technical solution is as follows:
[0005] On the one hand, a personal sensitive information knowledge graph query method is provided, which comprises:
[0006] S1, correcting text errors of a user input query text;
[0007] S2, input construction of the corrected query text to obtain a query text in a specific input format required by subsequent processes;
[0008] S3, text information recognition of the corrected query text and the query text with a specific input format, the text information recognition comprising: named entity recognition, privacy information recognition, modification phrase recognition and scene information recognition;
[0009] S4, generating query sentence fragments according to the recognized text information, the query sentence fragment generation comprising: query starting node generation, query condition generation and query purpose generation;
[0010] S5, splicing the query sentence fragments to form a complete knowledge graph Cypher query statement.
[0011] Optionally, the S2 input construction of the corrected query text to obtain a query text in a specific input format required by subsequent processes, specifically comprising:
[0012] The corrected query text is segmented and aligned according to a preset maximum text length. If a segmented text fragment is longer than the maximum text length, the segmented text fragment is deleted. If a segmented text fragment is shorter than the maximum text length, a specified symbol is filled in to make the segmented text fragment reach the maximum text length.
[0013] The aligned text segments are then segmented into words.
[0014] The segmented and aligned text fragments are used as input for subsequent named entity recognition and privacy information recognition, while the word segmentation results are used as input for subsequent modified phrase recognition.
[0015] Optionally, S3 performs named entity recognition on the corrected query text and the query text with a specific input format, specifically including:
[0016] The segmented and aligned text fragments are input into the named entity recognition model to identify the named entities present in the query text, which is used to support the analysis of the user's query intent.
[0017] The named entity recognition model includes: Hanlp and Jieba, which use open-source NLP tools, or a named entity recognition model customized for a specific domain;
[0018] The S3 process for identifying privacy information in the corrected query text and the query text with a specific input format includes: inputting the segmented and aligned text fragments into the privacy information identification model to identify the privacy information present in the query text;
[0019] The privacy information identification model includes: a pre-trained sequence labeling model, or a privacy dictionary using a specific domain;
[0020] The step S3, which involves identifying modified phrases in the corrected query text and the query text with a specific input format, specifically includes:
[0021] The word segmentation results are input into a general dependency parsing model for syntactic parsing, extracting the direct object of the root node and extracting the various modifying phrases of the direct object.
[0022] Optionally, step S3 involves scene information recognition of the corrected query text and the query text with a specific input format, specifically including:
[0023] The corrected query text is input into a classification neural network model, which understands the semantics of the query text and outputs labels corresponding to different scenarios. The classification neural network model includes: a recurrent neural network model, a convolutional neural network model, or other neural network models for text classification.
[0024] When the classification neural network model is a recurrent neural network model, after receiving the text input and performing word vector encoding embedding, the recurrent neural network model calculates the operation at t = l as defined in formulas (1) and (2):
[0025] h l =f(U·x l +W·h l-1 ) (1)
[0026] y l =g(V·h l ) (2)
[0027] Where f, g are activation functions, U is the weight from the input layer to the hidden layer, W is the weight from the hidden layer to the hidden layer, V is the weight from the hidden layer to the output layer, x l represents the input of the model at l, h l represents the input of the hidden layer at l, y l represents the output of the model at l.
[0028] Optionally, according to the identified text information, the S4 generates a query starting node, specifically including:
[0029] According to the identified named entity information, scene information and the corrected query text, a query starting node statement of the knowledge graph query language Cypher is generated;
[0030] Wherein, using a deep neural network model to determine whether all identified named entities include a starting node, if so, generating a Cypher query starting node statement according to the entity name of the starting node, otherwise, not generating a query starting node statement, and continuing to generate a subsequent query condition and a query purpose, and splicing the query condition and the query purpose into a statistical query statement;
[0031] The input of the deep neural network model needs to be specially processed, and a special mark is used to define the entity range, and the special mark is connected at the end of the query text and shares the entity position code;
[0032] The deep neural network model is divided into three layers, the bottom layer understands the semantic of the query text, and encodes the special mark to contain the information of the entity; the middle layer is a feature selection layer, which selects the vector output of the position of the special mark; the high layer is a multi-head classification layer, which is composed of multiple linear classifiers, and each different scene has an independent classifier, ensuring that the deep neural network model can correctly judge the entity under different scenes without mutual interference;
[0033] The deep neural network model selects a suitable classifier according to the identified scene information to perform binary classification on the vector at the position of the special mark, to determine whether it belongs to a start node.
[0034] Optionally, the S4 includes the following steps of generating a query condition according to the identified text information:
[0035] The generated model is used for semantic understanding of the identified modification phrase, and a query condition sentence of a single Cypher is generated.
[0036] In the generation process, a prompt learning method is used to customize a dedicated scene prompt information for each scene.
[0037] The generation model based on prompt learning needs to perform special processing on the output of the model, and a dedicated scene prompt information is preset at the 0 position of the model output, which is used as the output of the model, so as to integrate the identified scene information into the generation model, and finally obtain all the text from the prompt information to the end position as the output result of the model.
[0038] Optionally, the S4 includes the following steps of generating a query purpose according to the identified text information:
[0039] A mapping table of keywords and corresponding attributes of the knowledge graph is constructed.
[0040] A root node direct object is extracted from the corrected query text by using a general dependency syntax model.
[0041] According to the content corresponding to the direct object and the identified privacy information, the mapping table is matched, if the matching is successful, the corresponding attribute knowledge graph query statement of the query entity is returned; if the matching is unsuccessful, the direct object is classified by an aggregation operation classification model to return the required aggregation operation, and a knowledge graph query statement of the corresponding aggregation operation is generated.
[0042] The aggregation operation classification model is divided into two layers, the bottom layer structure uses a recurrent neural network as a feature extraction, and the upper layer structure uses multiple linear classifiers as the output layer of the model, each different scene has an independent classifier, which ensures that the model can correctly judge the entity in different scenes and will not interfere with each other.
[0043] On the other hand, a personal sensitive information knowledge graph query device is provided, and the device includes:
[0044] The error correction module is configured to correct text errors in the query text input by the user.
[0045] The input construction module is configured to construct the query text in a specific input format required by the subsequent process.
[0046] The text information recognition module is configured to perform text information recognition on the corrected query text and the query text with the specific input format, and the text information recognition includes named entity recognition, privacy information recognition, modification phrase recognition, and scene information recognition.
[0047] The query statement fragment generation module is configured to generate query statement fragments according to the recognized text information, and the query statement fragment generation includes query starting node generation, query condition generation, and query purpose generation.
[0048] The splicing module is configured to splice the query statement fragments to form a complete knowledge graph Cypher query statement.
[0049] In another aspect, an electronic device is provided, which includes a processor and a memory, the memory having stored therein at least one instruction, the at least one instruction being loaded and executed by the processor to implement the above-described personal sensitive information knowledge graph query method.
[0050] In another aspect, a computer-readable storage medium is provided, the storage medium having stored therein at least one instruction, the at least one instruction being loaded and executed by a processor to implement the above-described personal sensitive information knowledge graph query method.
[0051] The technical solution provided by the present application has at least the following beneficial effects:
[0052] The present application can intelligently analyze the query scene of a user and automatically generate a sensitive information knowledge graph Cypher query statement Cypher in a specified scene by using deep semantic analysis technology in combination with the query scene of the user, without the need for manual addition of a large number of templates and subsequent maintenance, thereby greatly reducing the development difficulty.
[0053] In addition, the present application enables a user to query a multi-scene personal sensitive information knowledge graph using natural language, without the need for the user to additionally select an actual scene, thereby greatly reducing the use difficulty of the user and eliminating the need for special learning of a knowledge graph query language. BRIEF DESCRIPTION OF DRAWINGS
[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0055] Figure 1 is a personal sensitive information knowledge graph query method flowchart provided by the embodiments of the present application;
[0056] Figure 2 is an example of an actual application scenario provided by the embodiment of the present application;
[0057] Figure 3 is another personal sensitive information knowledge graph query method flowchart provided by the embodiment of the present application;
[0058] Figure 4 is a personal sensitive information knowledge graph query device block diagram provided by the embodiment of the present application;
[0059] Figure 5 is a structure diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0060] As shown in Figure 1 , the embodiment of the present application provides a personal sensitive information knowledge graph query method, which comprises:
[0061] S1, correcting text errors of the query text input by the user;
[0062] S2, input construction is performed on the corrected query text to obtain a query text in a specific input format required by a subsequent process;
[0063] S3, text information recognition is performed on the corrected query text and the query text with the specific input format, and the text information recognition comprises: named entity recognition, privacy information recognition, modification phrase recognition and scene information recognition;
[0064] S4, according to the recognized text information, query sentence segment generation is performed, and the query sentence segment generation comprises: query starting node generation, query condition generation and query purpose generation;
[0065] S5, the query sentence segments are spliced to form a complete knowledge graph Cypher query statement.
[0066] The embodiment of the present application will be described in detail below Figures 2-3 in combination with
[0067] As shown in Figure 2As shown, the actual application scene of the embodiment of the present application is exemplified, in the actual application scene, the personal sensitive information knowledge graph is usually constructed based on information in different fields, so that the focus of the knowledge graph may differ, for example, the personal sensitive information in the financial field focuses more on financial accounts, personal transactions, asset information, loan information, etc., and the knowledge graph in the medical field tends to health status, medical history information, etc. The application of the embodiment of the present application is to query the personal sensitive information knowledge graph, especially to query the multi-scene personal sensitive information knowledge graph, so as to provide better support for downstream intelligent customer service, correlation analysis, privacy leakage mechanism discovery, etc.
[0068] The pre-work of the embodiment of the present application can include collecting data based on different scenes, constructing a multi-scene personal sensitive information knowledge graph, and the conventional process includes operations such as data cleaning, named entity recognition, sensitive information extraction, attribute relationship extraction, and entity linking.
[0069] As shown, the personal sensitive information knowledge graph query method of the embodiment of the present application includes: Figure 3
[0070] S1, text error correction is performed on the query text input by the user;
[0071] Optionally, the S1 of performing text error correction on the query text input by the user specifically includes:
[0072] A list of homophonic words or homographic words prone to spelling errors is constructed using a binary language model;
[0073] The words in the query text input by the user that appear in the word list are replaced by homophonic words or homographic words, the probability of each replacement word is calculated, the replacement word with the highest probability is selected, and the context is combined to form the corrected query text.
[0074] Optionally, the binary language model can be trained using a large amount of data in a statistical manner, or a binary language model that has been trained online can be directly used.
[0075] S2, input construction is performed on the corrected query text to obtain a query text in a specific input format required by a subsequent process;
[0076] Optionally, the S2 of input construction on the corrected query text to obtain a query text in a specific input format required by a subsequent process specifically includes:
[0077] cut and align the error-corrected query text according to a preset maximum text length, if a certain text segment after cutting is greater than the maximum text length, the certain text segment after cutting is deleted; if a certain text segment after cutting is less than the maximum text length, a specified symbol is filled to make the certain text segment after cutting reach the maximum text length;
[0078] cut and align the error-corrected query text according to a preset maximum text length, if a certain text segment after cutting is greater than the maximum text length, the certain text segment after cutting is deleted; if a certain text segment after cutting is less than the maximum text length, a specified symbol is filled to make the certain text segment after cutting reach the maximum text length;
[0079] cut and align the error-corrected query text according to a preset maximum text length, if a certain text segment after cutting is greater than the maximum text length, the certain text segment after cutting is deleted; if a certain text segment after cutting is less than the maximum text length, a specified symbol is filled to make the certain text segment after cutting reach the maximum text length;
[0080] S3, text information recognition is performed on the error-corrected query text and the query text with the specific input format, and the text information recognition includes: named entity recognition, privacy information recognition, modifier phrase recognition, and scene information recognition;
[0081] Optionally, the S3 performs named entity recognition on the error-corrected query text and the query text with the specific input format, and specifically includes:
[0082] cut and align the error-corrected query text according to a preset maximum text length, if a certain text segment after cutting is greater than the maximum text length, the certain text segment after cutting is deleted; if a certain text segment after cutting is less than the maximum text length, a specified symbol is filled to make the certain text segment after cutting reach the maximum text length;
[0083] Named entity (named entity) is a name, an organization name, a place name, and all other entities identified by a name. The named entity recognition and the supported nodes in the knowledge graph of the embodiment of the application correspond. If the knowledge graph supports storage of persons, places, organizations, and others, the named entity recognition also needs to support it.
[0084] The identified named entity is used for analyzing the user query intent. For example, which entity information does the user need to query from the multi-scene personal sensitive information knowledge graph?
[0085] The named entity recognition model includes: Hanlp and Jieba using an open source NLP tool, or a specific domain customized named entity recognition model.
[0086] The S3 performs privacy information recognition on the error-corrected query text and the query text with the specific input format, and specifically includes: inputting each text segment after cutting and aligning into a privacy information recognition model to identify the privacy information existing in the query text;
[0087] The privacy information includes: personal date of birth, weight, identity card number, photo, and the like.
[0088] The privacy information recognition model comprises a pre-trained sequence labeling model or a privacy dictionary of a specific field;
[0089] The S3 performs modification phrase recognition on the corrected query text and the query text with the specific input format, and specifically comprises:
[0090] The segmented result is input into a general dependency syntax model for syntax analysis, direct objects of root nodes are extracted, and each modification phrase of the direct objects is extracted.
[0091] The syntax analysis is to construct a syntax tree by judging the dependency relationship between different segmented words in the text, wherein the root node is the most critical node in the sentence, and the root node is selected because the backbone of the sentence can be extracted through the root node.
[0092] The direct objects of the root node can be multiple, and the multiple direct objects of the root node and each modification phrase of each direct object are extracted.
[0093] Optionally, the S3 performs scene information recognition on the corrected query text and the query text with the specific input format, and specifically comprises:
[0094] The corrected query text is input into a classification neural network model, the classification neural network model understands the semantic of the query text, and outputs labels corresponding to different scenes, and the classification neural network model comprises a recurrent neural network model, a convolutional neural network model or other neural network models for text classification;
[0095] When the classification neural network model is a recurrent neural network model, after receiving the text input and performing word vector coding embedding, the recurrent neural network model calculates the operation at t=l, and the definition is as formula (1) and (2):
[0096] h l = f(U·x l +W·h l-1 ) (1)
[0097] y l = g(V·h l ) (2)
[0098] Wherein f and g are activation functions, U is the weight from the input layer to the hidden layer, W is the weight from the hidden layer to the hidden layer, V is the weight from the hidden layer to the output layer, x l represents the input of the model at l, h l represents the input of the hidden layer at l, and y l represents the output of the model at l.
[0099] The word vector encoding embedding can be a Word2Vev encoding embedding, a BERT encoding embedding or other encoding embedding manners: the f can be an activation function such as Sigmoid, tanh, ReLu, etc.: the g is usually a Softmax.
[0100] Optionally, the hyperparameter settings of the recurrent neural network are as follows: the maximum input length is set to 20, the hidden layer dimension is 512, the training round is 20, the initial learning rate is 0.001, and the network output layer dimension is set to the number of scenes, so as to obtain the scene label expected by the query statement. That is, the multi-scene personal sensitive information knowledge graph may contain knowledge of many scenes, such as medical treatment, credit, and social interaction. The embodiment of the application automatically perceives the knowledge field (the scene label expected by the query statement) that the user wants to know through the natural language text input by the user, and queries in the knowledge graph.
[0101] The user inputs the query text in the form of natural language, for example: What is the appearance picture of Zhang San on the social network? After the text error correction and input construction by the bigram language model, the embodiment of the application obtains the named entity as Zhang San, the privacy information as appearance, the scene information as social interaction, and the modification phrase as social network through the named entity recognition, privacy information recognition, scene information recognition and modification phrase recognition. Finally, the query statement fragment is generated through the neural network model according to the above text information, the query statement fragment is spliced, and a complete knowledge graph Cypher query statement is formed.
[0102] Cypher: a descriptive graph database query language that allows expressive and efficient queries on graph storage without having to write traversal code for graph structures. The embodiment of the application automatically forms a knowledge graph Cypher query statement according to the natural language form of the query text input by the user.
[0103] S4, according to the identified text information, query statement fragment generation, the query statement fragment generation includes: query starting node generation, query condition generation and query purpose generation;
[0104] Optionally, the S4 according to the identified text information, the query starting node generation specifically includes:
[0105] According to the identified named entity information, scene information and corrected query text, a query starting node statement of the knowledge graph query language Cypher is generated:
[0106] Wherein, using the deep neural network model to determine whether all named entities include the start node, if yes, generating the Cypher query start node statement according to the entity name of the start node, otherwise, not generating the query start node statement, continuing to generate the subsequent query condition and the query purpose, and splicing the query condition and the query purpose into the statistical query statement;
[0107] Generally, the start node is included in the multiple named entities of the query text, such as the query text: what is the ID number of Zhang San? Zhang San is the start node. But there are also query texts that do not include the start node, such as: how many people are older than 25 years old?
[0108] The query text generally includes only one start node, and can also include multiple start nodes, when including multiple start nodes, generating the Cypher query start node statement according to the multiple start nodes, and juxtaposing the multiple start nodes in the Cypher query start node statement.
[0109] The input of the deep neural network model needs to be specially processed, using special markers to define the entity range, and the special markers are connected at the end of the query text and share the entity position code;
[0110] For example, using “[unused1]” to mark the start position of the entity, and “[unused2]” to mark the end position of the entity, and connecting the special markers at the end of the query text and sharing the entity position code, such as the query text: what companies are likely to leak the ID number of Wang? After processing, the text “what companies are likely to leak the ID number of Wang? [unused1] [unused2]” is formed, wherein the position code of “[unused1]” is the same as that of “Wang”, such as 7; the position code of “[unused2]” is the same as that of “certain”, such as 8.
[0111] The deep neural network model is divided into three layers, the bottom layer, such as the BERT model, can understand the semantics of the query text and encode the special markers to contain the information of the entity; the middle layer is the feature selection layer, which selects the vector output of the position of the special marker, such as the vector output of the position of “[unused1]”; the high layer is the multi-head classification layer, which is composed of multiple linear classifiers, and each different scenario has an independent classifier, ensuring that the deep neural network model can correctly judge the entity in different scenarios without interference;
[0112] The deep neural network model selects the appropriate classifier according to the identified scenario information to perform binary classification on the vector at the position of the special marker to determine whether it belongs to the start node.
[0113] Optionally, the hyperparameter settings of the deep neural network model are as follows: the input maximum length is set to 40, the classification layer input dimension is 768, the output dimension is 2, the number of classifiers is the same as the number of scenes, the training round is 20, the initial learning rate is 0.00002, when one classifier is trained, the weights of other classifiers remain unchanged, and when the classifier is trained, the parameters of the underlying BERT network are trained together.
[0114] Optionally, the S4 generates a query condition according to the identified text information, and specifically includes:
[0115] The generated model is used for semantic understanding of the identified modification phrase, and a query condition sentence of a single Cypher is generated.
[0116] The generated model can adopt T5 or other generated models.
[0117] In the generation process, a prompt learning method is used to customize exclusive scene prompt information for each scene.
[0118] The exclusive scene prompt information is used to facilitate the generated model to better mine semantic information, and the scene information can also be considered.
[0119] The generated model based on prompt learning needs to specially process the output of the model, and a segment of exclusive scene prompt information is preset at the 0 position of the model output, which is used as the output of the model, so as to integrate the identified scene information into the generated model, and finally obtain all the text from the prompt information to the end position as the output result of the model.
[0120] The normal generated model directly obtains all the text from the 0 position of the model output to the end position as the model result, but in this way, the model cannot generate different Cypher query condition sentences according to different scene information. The generated model based on prompt learning in the embodiment of the application presets a segment of exclusive scene prompt information at the 0 position of the model output, such as the current scene is financial lending, and the prompt information "in the financial lending scene, the Cypher query condition sentence is:" is preset at the 0 position of the output as the output of the model. The subsequent model output will be adjusted according to the existing text, so as to integrate the scene information into the generated model, and finally obtain all the text from the prompt information to the end position as the output result of the model. The prompt information output by the model will be replaced according to the scene of the model.
[0121] Optionally, the hyperparameter settings of the generated model are as follows: the input maximum length is set to 10, the generated text maximum length is 20, the training round is 20, and the initial learning rate is 0.00003.
[0122] Optionally, the S4 generates a query purpose according to the identified text information, specifically including:
[0123] A mapping table of keywords and corresponding attributes of the knowledge graph is constructed.
[0124] For example, the keyword "height" corresponds to the attribute "height" of the knowledge graph, and a mapping table of the two is constructed.
[0125] The direct object of the root node is extracted from the corrected query text using a general dependency syntax model.
[0126] According to the content corresponding to the direct object and the identified privacy information, the mapping table is used for matching. If the matching is successful, the corresponding attribute knowledge graph query statement of the query entity is returned. If the matching is not successful, the direct object is classified by an aggregation operation classification model to return the required aggregation operation, and a knowledge graph query statement corresponding to the aggregation operation is generated.
[0127] Because the direct object may not be able to obtain direct privacy information, the content corresponding to the direct object and the identified privacy information can be double-judged. When the direct object and the privacy information overlap, both results can be used as the query purpose. If there is one of the two, the other result is used as the query purpose. If there is a conflict, the direct object is used preferentially.
[0128] For example, the user inputs the query: How tall is Li Si? The direct object is height, and the user's query purpose is to obtain the height attribute as the query result. If the user inputs the query text that cannot directly obtain the query purpose, such as: Who is the mother of Li Si's father? At this time, the "father's mother" needs to be aggregated, and the user's query purpose is "grandmother" attribute.
[0129] The aggregation operation classification model is divided into two layers. The bottom layer structure uses a recurrent neural network as a feature extraction, and the upper layer structure uses multiple linear classifiers as the output layer of the model. Each different scenario has an independent classifier to ensure that the model can correctly judge the entity in different scenarios without interference.
[0130] Optionally, the aggregation operation classification model has the following parameter settings: the maximum input length is set to 5, the recurrent neural network hidden layer dimension is 256, the output layer dimension is 256, the input dimension of the upper neural network is 256, the output dimension is the number of Cypher language aggregation operations, the number of scenarios is 20, the initial learning rate is 0.001.
[0131] S5, the query statement fragments are spliced to form a complete knowledge graph Cypher query statement.
[0132] The relationship between the plurality of query conditions needs to be determined first, and the generated query statement fragments are spliced according to the grammar to form a complete knowledge graph Cypher query statement.
[0133] The embodiment of the application further provides a personal sensitive information knowledge graph query device, the device comprising:
[0134] The error correction module 410 is configured to perform text error correction on the query text input by the user.
[0135] The input construction module 420 is configured to perform input construction on the query text after error correction to obtain the query text in a specific input format required by a subsequent process.
[0136] The text information recognition module 430 is configured to perform text information recognition on the query text after error correction and the query text in the specific input format, the text information recognition comprising: named entity recognition, privacy information recognition, modification phrase recognition and scene information recognition.
[0137] The query statement fragment generation module 440 is configured to generate query statement fragments according to the recognized text information, the query statement fragment generation comprising: query starting node generation, query condition generation and query purpose generation.
[0138] The splicing module 450 is configured to splice the query statement fragments to form a complete knowledge graph Cypher query statement.
[0139] The personal sensitive information knowledge graph query device provided by the embodiment of the application corresponds to the personal sensitive information knowledge graph query method provided by the embodiment of the application in terms of function structure, and will not be described here.
[0140] Figure 5 is a structural schematic diagram of an electronic device 500 provided by the embodiment of the application, the electronic device 500 can have relatively large differences due to different configurations or performances, and can comprise one or more processors (central processing units, CPUs) 501 and one or more memories 502, wherein the memory 502 stores at least one instruction, the at least one instruction is loaded and executed by the processor 501 to realize the steps of the above-mentioned personal sensitive information knowledge graph query method.
[0141] In the example embodiment, a computer readable storage medium, such as a memory including instructions executable by a processor in a terminal to perform the above personal sensitive information knowledge graph query method is also provided. For example, the computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0142] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by a program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium, such as a read-only memory, a magnetic disk or an optical disk.
[0143] The above description is merely preferred embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A personal sensitive information knowledge graph query method, characterized in that, The method comprises: S1, text error correction on the user input query text; S2, input construction on the corrected query text, to obtain a query text in a specific input format required by a subsequent process; S3, text information recognition on the corrected query text and the query text in the specific input format, the text information recognition comprising: named entity recognition, privacy information recognition, modification phrase recognition, and scene information recognition; S4, query statement segment generation according to the recognized text information, the query statement segment generation comprising: query starting node generation, query condition generation, and query purpose generation; S5, splicing of the query statement segments to form a complete knowledge graph Cypher query statement; The S4 query starting node generation according to the recognized text information specifically comprises: generating a knowledge graph query language Cypher query starting node statement according to the recognized named entity information, scene information, and corrected query text; wherein, a deep neural network model is used to determine whether all recognized named entities include a starting node, if yes, a Cypher query starting node statement is generated according to the entity name of the starting node, otherwise, no query starting node statement is generated, and subsequent query condition generation and query purpose generation are continued, and the query condition and the query purpose are spliced into a statistical query statement; the deep neural network model input needs to be specially processed, and a special mark is used to define the entity range, the special mark is connected at the end of the query text and shares the entity position code; the deep neural network model is divided into three layers, the bottom layer understands the query text semantics and encodes the special mark to contain entity information; the middle layer is a feature selection layer that selects the vector output at the position of the special mark; the high layer is a multi-head classification layer composed of multiple linear classifiers, each different scene has an independent classifier, ensuring that the deep neural network model can correctly judge the entity in different scenes without interference; the deep neural network model selects a suitable classifier according to the recognized scene information to perform binary classification on the vector at the position of the special mark to determine whether it belongs to the starting node; The S4 query condition generation according to the recognized text information specifically comprises: using a generation model to understand the semantics of the recognized modification phrase and generating a single Cypher query condition statement; wherein, a prompt learning method is used to customize a dedicated scene prompt information for each scene during the generation process; the generation model based on prompt learning needs to specially process the output of the model, and a dedicated scene prompt information is preset at the 0 position of the model output as the output of the model, so as to integrate the recognized scene information into the generation model, and finally obtain all the text from the prompt information to the end position as the output result of the model.
2. The method of claim 1, wherein, The S2 input construction on the corrected query text to obtain a query text in a specific input format required by a subsequent process specifically comprises: The corrected query text is split and aligned according to a preset maximum text length, if a split text segment is greater than the maximum text length, the split text segment is deleted; if a split text segment is less than the maximum text length, a specified symbol is filled to make the split text segment reach the maximum text length; The aligned text segments are segmented; The segmented and aligned text segments are used as inputs for subsequent named entity recognition and privacy information recognition, and the segmentation results are used as inputs for subsequent modifier phrase recognition.
3. The method of claim 2, wherein, The S3 performs named entity recognition on the corrected query text and the query text with a specific input format, specifically including: The segmented and aligned text segments are input into a named entity recognition model to recognize the named entities existing in the query text, which supports analysis of the user query intent; The named entity recognition model includes: Hanlp, Jieba using an open source NLP tool, or a specific domain customized named entity recognition model; The S3 performs privacy information recognition on the corrected query text and the query text with a specific input format, specifically including: the segmented and aligned text segments are input into a privacy information recognition model to recognize the privacy information existing in the query text; The privacy information recognition model includes: a pre-trained sequence labeling model, or a specific domain privacy dictionary; The S3 performs modifier phrase recognition on the corrected query text and the query text with a specific input format, specifically including: The segmentation results are input into a general dependency syntax model for syntax analysis, the direct object of the root node is extracted, and each modifier phrase of the direct object is extracted.
4. The method of claim 2, wherein, The S3 performs scene information recognition on the corrected query text and the query text with a specific input format, specifically including: The corrected query text is input into a classification neural network model, the classification neural network model understands the query text semantics, and outputs labels corresponding to different scenes, the classification neural network model includes: a recurrent neural network model, a convolutional neural network model, or other neural network models for text classification; When the classification neural network model is a recurrent neural network model, after receiving a text input and performing word vector encoding embedding, the recurrent neural network model calculates an operation at time t= defined as formulas (1) and (2): (1) (2) where f,g are activation functions, are weights from the input layer to the hidden layer, are weights from the hidden layer to the hidden layer, are weights from the hidden layer to the output layer, denotes the input to the model at time step t, denotes the input to the hidden layer at time step t, denotes the output of the model at time step t.
5. The method of claim 1, wherein, The S4 generates a query purpose according to the recognized text information, specifically including: A mapping table of keywords and corresponding attributes of a knowledge graph is constructed; The direct object of the root node is extracted from the corrected query text using a general dependency syntax model; According to the content corresponding to the direct object and the recognized privacy information, the mapping table is matched, if the matching is successful, the corresponding attribute knowledge graph query statement of the query entity is returned; if the matching is unsuccessful, the direct object is classified by an aggregation operation classification model to return the required aggregation operation, and a knowledge graph query statement corresponding to the aggregation operation is generated; The polymeric operation classification model is divided into two layers, the bottom layer structure uses a recurrent neural network as feature extraction, and the upper layer structure uses multiple linear classifiers as the output layer of the model, each different scene has an independent classifier, ensuring that the model can correctly judge the entity under different scenes and will not interfere with each other. 6.A personal sensitive information knowledge graph query device, used for implementing the personal sensitive information knowledge graph query method in any one of claims 1 to 5, characterized in that, The device comprises: An error correction module configured to correct text errors in the query text input by the user; An input construction module configured to construct the query text after error correction into a specific input format required by a subsequent process; A text information recognition module configured to recognize text information in the query text after error correction and the query text with the specific input format, the text information recognition including: named entity recognition, privacy information recognition, modification phrase recognition, and scene information recognition; A query statement segment generation module configured to generate query statement segments according to the recognized text information, the query statement segment generation including: query starting node generation, query condition generation, and query purpose generation; A splicing module configured to splice the query statement segments to form a complete knowledge graph Cypher query statement. 7.An electronic device comprising a processor and a memory in which at least one instruction is stored, wherein, The at least one instruction is loaded and executed by the processor to implement the personal sensitive information knowledge graph query method according to any one of claims 1-5.
8. A computer-readable storage medium having stored therein at least one instruction, wherein The at least one instruction is loaded and executed by the processor to implement the personal sensitive information knowledge graph query method according to any one of claims 1-5.
Citation Information
Patent Citations
Intelligent question-answering method and system based on power grid field scheduling scene knowledge graph
CN112527997A
Knowledge graph question-answer method and apparatus based on deep learning technology, and device
WO2021139283A1