WO2021174871A1 - Data query method and system, computer device, and storage medium - Google Patents

Data query method and system, computer device, and storage medium Download PDF

Info

Publication number
WO2021174871A1
WO2021174871A1 PCT/CN2020/123092 CN2020123092W WO2021174871A1 WO 2021174871 A1 WO2021174871 A1 WO 2021174871A1 CN 2020123092 W CN2020123092 W CN 2020123092W WO 2021174871 A1 WO2021174871 A1 WO 2021174871A1
Authority
WO
WIPO (PCT)
Prior art keywords
word
sequence
intent
attention
self
Prior art date
Application number
PCT/CN2020/123092
Other languages
French (fr)
Chinese (zh)
Inventor
王昊
张乐情
罗水权
刘剑
李果夫
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021174871A1 publication Critical patent/WO2021174871A1/en

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/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • 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/35Clustering; Classification
    • 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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Definitions

  • the embodiments of the present application relate to the field of big data technology, and in particular, to a data query method, system, computer device, and storage medium.
  • automatic retrieval based on knowledge graphs based on search engines generally uses entity recognition replacement and text matching.
  • entity recognition is used to find entity words for replacement. For example, when a user queries “what is Yao Ming's height”, Then it finds [ ⁇ ], replaces [ ⁇ ] with [Celebrity], finds [ ⁇ ], and replaces [ ⁇ ] with [data], that is, the user sentence is transformed into "What is the [data] of [Celebrity]", Then the sentence is matched with the sample sentence in the back-end database through a text matching algorithm, and it is successfully matched to the intention of "[Celebrity]’s [information]”. Finally, the person named "Yao Ming" is queried in the knowledge graph database and the data is "Height". The attribute value can then be returned to the user with the answer.
  • the inventor realizes that the above-mentioned intent identification search query method requires manual maintenance of a large number of sample sentences. For queries with multiple intents, and when the query does not match the template of the sample sentence, the correct query answer cannot be returned. . The query efficiency and accuracy rate are low through the above-mentioned intent recognition search query method.
  • the embodiments of the present application provide a data query method, system, computer equipment, and computer readable storage medium, which are used to solve the problem of low query efficiency and low accuracy through the above-mentioned entity recognition and text matching search query. problem.
  • a data query method including:
  • an embodiment of the present application further provides a data query system, including:
  • a receiving module configured to receive a first request, the first request carrying a first original sentence
  • the sequence labeling module is used to classify the first original sentence and generate sequence labeling results
  • the first generation module is configured to obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
  • the second generation module is configured to generate multiple intent stream analysis results based on the multiple word attention matrices
  • the query module is used to query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  • an embodiment of the present application further provides a computer device.
  • the computer device includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the Perform the following steps in the computer program:
  • the embodiments of the present application also provide a computer-readable storage medium having a computer program stored in the computer-readable storage medium, and the computer program may be executed by at least one processor, so that the at least A processor performs the following steps:
  • the data query method, system, computer equipment, and computer-readable storage medium provided by the embodiments of the present application realize the extraction of intentions and the attention mechanism to associate multiple intentional words and non-intentional words through sequence labeling, which effectively solves the multiplicity of original query sentences.
  • the problem of inaccurate query results in the case of intent improves query efficiency.
  • Fig. 1 is a flow chart of the steps of the data query method according to the first embodiment of the application
  • FIG. 2 is a flow chart of the steps of converting the first original sentence into a vector sequence in the data query method according to the first embodiment of the application;
  • FIG. 3 is a flowchart of the steps of generating sequence labeling results in the data query method according to the first embodiment of the application;
  • FIG. 4 is a flowchart of the steps of generating a plurality of word attention matrices in the data query method according to the first embodiment of the application;
  • FIG. 5 is a flowchart of steps for generating multiple intent stream analysis results in the data query method according to the first embodiment of the application;
  • FIG. 6 is a flow chart of the steps of querying through the knowledge graph database in the data query method of the first embodiment of the application;
  • FIG. 7 is a flowchart of the steps of training a sequence labeling task model in the data query method according to the first embodiment of the application;
  • FIG. 8 is a schematic diagram of program modules of the data query system according to the second embodiment of the application.
  • FIG. 9 is a schematic diagram of the hardware structure of a computer device according to the third embodiment of the application.
  • FIG. 1 shows a flowchart of the steps of the data query method according to an embodiment of the present application. It can be understood that the flowchart in this method embodiment is not used to limit the order of execution of the steps.
  • the following is an exemplary description with computer equipment as the main body of execution, and the details are as follows:
  • the data query method may include steps S100 to S500, wherein:
  • Step S100 Receive a first request, where the first request carries a first original sentence.
  • the first request is used to request a search query for the first original sentence. After receiving the first request, the first original sentence in the first request is obtained, and the first original sentence is converted into a vector sequence.
  • the step S100 of receiving the first request, the first request carrying the first original sentence includes:
  • Step S101 Map the first original sentence into a first identification sequence and a second identification sequence.
  • Step S102 Map the first identification sequence to a first word vector sequence, and map the second identification sequence to a first position vector sequence.
  • a word list of commonly used words is preset (for example, 2w words commonly used in a dictionary, each word corresponds to a digital ID in the dictionary), and the first identification sequence refers to the first original sentence The numeric ID corresponding to each word in the dictionary.
  • the first original sentence takes "the name price of the bond issued by Hainan Airlines and the name of the bond issued by its holding parent company" as an example.
  • this sentence there are only 29 words, and 29 words are mapped to the digital ID, namely [12, 23, 13,42,56,...], and add 0 to extend the length of the above-mentioned insufficient number of IDs to 512, where 512 is the default maximum sentence length in the model, which can also be changed according to actual needs.
  • the maximum length of a sentence is 512 as an example. If the length of a sentence is greater than 512, the excess part of the digital ID corresponding to the first original sentence will be truncated.
  • the first identification sequence of the first original sentence is [12, 23, 13, 42, 56, 0, 0,..., 0].
  • the above-mentioned first identification sequence with a length of 512 is mapped to a first word vector sequence of 512*768 (the parameter is bert default and can be changed) through the embeding (word embedding) layer, that is, the first identification sequence is mapped to a distributed first word Vector sequence.
  • the second identification sequence is the position ID number of each word in the first original sentence in the first original sentence
  • the first position vector is a 512*768 position vector code
  • Mapped to the first position vector where p represents the position ID number, which corresponds to [0-511] according to the position, 2i and 2i+1 correspond to the even and odd positions of p respectively, and dpos here refers to the dimension of the position vector, that is, 768 dimensions .
  • Step S200 Classify the first original sentence, and generate a sequence labeling result.
  • the first original sentence may be classified by a sequence labeling task model, where the sequence labeling task model is a model based on a bert model.
  • the sequence labeling task model includes an encoder and a decoder, where the encoder is an encoder with bert as the backbone, sentence features are extracted, and the hidden layer dimension is set to 768.
  • the encoder output is 512*768 dimensions.
  • the first word vector sequence and the first position sequence are added by position and input into the encoder of the sequence labeling task model, and a 512*768 vector set can be output through multiple encoders.
  • Each decoder includes: a self-attention layer in the decoder, an encoding-decoding attention layer, and a forward propagation neural network layer.
  • the decoder also includes 512 fully connected layers with an output dimension of 9. Through full connection, the 512*768-dimensional vector set finally output by the encoder is reduced to 512*9 dimensions. 512 corresponds to each position, and 9 corresponds to each type of label, where each type of label is preset.
  • each position outputs a 9-dimensional vector, and each dimension corresponds to a label, which is added to form a real number vector, and then the real number vector is classified through the softmax (normalization) layer to obtain the highest probability Position, output sequence labeling result.
  • the step S200 of classifying the first original sentence and generating a sequence labeling result includes:
  • step S201 the first word vector sequence and the first position vector sequence are added into the sequence labeling task model by position addition.
  • Step S202 A plurality of encoders based on the sequence labeling task model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set.
  • Step S203 Input the vector set into multiple decoders of the sequence labeling task model, perform decoding and dimensionality reduction processing on the vector set based on the multiple decoders, and output a target vector.
  • Step S204 Perform a linear transformation on the target vector by a classifier, and output a sequence labeling result.
  • the output sequence labeling result is:
  • _B represents the first character of a certain word
  • _I represents the characters in other positions of a certain word
  • E represents entity entity
  • A represents attribute
  • T represents intent word target
  • R represents replace word.
  • sequence labeling can also be parsed into an easy-to-understand form, namely ⁇ entity word (knowledge graph node): ["Hainan Airlines”], attribute word (knowledge graph edge): ["issued bonds", “holding parent company” ,” The bond of the hairstyle”], the pronoun: [" ⁇ ”], the intent word: ["name", "price”, "name”] ⁇ .
  • Step S300 Obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result.
  • the self-attention matrix can be extracted from the transformer block of the first layer in the encoder, and the self-attention matrix is a symmetric 512*512 matrix that can be used to represent characters. Correlation with words.
  • the step S300 of acquiring preset self-attention matrix parameters and generating multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result may also be It further includes:
  • Step S301 Obtain the self-attention matrix parameters from the first layer encoder of the encoder.
  • Step S302 Generate a self-attention matrix for each word based on the self-attention matrix parameters.
  • the self-attention matrix of each word is the intermediate data in the sequence labeling task model.
  • the vectors Q, K, and V are obtained by multiplying the input vector matrix of the sequence labeling task model and the self-attention matrix parameters.
  • F is the self-attention matrix of the word
  • Q is the query sample vector
  • K is the key vector
  • KT is the transposition of the key vector
  • V is the value vector
  • dk is the dimension of the input vector.
  • Step S303 Obtain multiple target words and a self-attention matrix of each character in each target word based on the sequence labeling result.
  • Step S304 Based on the self-attention matrix of each character in each target word, the word attention matrix of the corresponding target word is calculated.
  • the sequence labeling is combined with the self-attention matrix to construct a word attention matrix of each word and other words to express the relevance between words.
  • the attention matrix of each word is the sum of squared attention corresponding to each word Add and average, where i represents the word at the i-th position, j represents the word at the j-th position, aij represents the self-attention matrix between the i-th word and the j-th word, and m refers to the target The number of characters in a word, n refers to the number of characters in a word in the first original sentence.
  • Step S400 Generate multiple intent stream analysis results based on the multiple word attention matrices.
  • the step S400 of generating multiple intent stream analysis results based on the multiple word attention matrices may further include:
  • Step S401 Take an average value from the word attention matrix of a plurality of target words, and define the average value as a threshold.
  • step S402 the word attention matrix of a plurality of the target words is compared with the threshold to generate a comparison result.
  • Step S403 based on the comparison result: determine that the target word whose word attention matrix is greater than the threshold is an intention-related word.
  • Step S404 Generate multiple intent stream analysis results based on the sequence labeling result and the intent related words.
  • the pronoun when the sequence labeling result contains a pronoun, the pronoun needs to be replaced with the word with the highest word attention matrix.
  • Step S500 Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  • the query result can be obtained directly through the query of the knowledge graph table/library, and the query result is returned to the user end.
  • the embodiments of the present application are based on the knowledge graph and can directly return the results required by the user, which improves the user experience.
  • the knowledge graph library is stored in a blockchain.
  • the knowledge graph table/library is a massive knowledge graph table/library, query the multiple intent stream analysis results through the knowledge graph library to obtain the query result S500 It can further include:
  • Step S501 Assemble the multiple intention flow analysis results into corresponding second sentences.
  • Step S502 Identify the second sentence, and generate an intent type corresponding to the second sentence.
  • Step S503 based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
  • multiple intent stream analysis results can be spliced directly with a separator to form multiple corresponding second sentences, such as ⁇ 1_name: [ ⁇ , issued bonds], 2_price: [ ⁇ , Bond issued], 3_ name: [ ⁇ , holding parent company, bond issued] ⁇ , spliced into three sentences, for example, using &&& as a separator, the three sentences are the name of the bond issued by Hainan Airlines &&&, Hainan The price of bonds issued by aviation &&&, and the bonds issued by Hainan Airlines (replaced by it) &&& holding parent company &&&).
  • the multi-intent stream recognition results are assembled into a sentence and sent to the Textcnn (text classification) model for classification.
  • the intents are divided into ten categories: 1. Query the bond name, 2. Query the bond price, 3...., Among them, the intention categories 1 and 2 correspond to the knowledge graph bond table.
  • the Textcnn model is an existing model, so I won’t repeat it here.
  • the method further includes:
  • Step S601 Obtain a plurality of sample original sentences and sample label labels corresponding to the plurality of sample original sentences.
  • Step S602 Map the multiple sample original sentences into a first sample identification sequence and a second sample identification sequence.
  • Step S603 Map the first sample identification sequence to a first sample word vector sequence, and map the second sample identification sequence to a first sample position vector.
  • Step S604 Input the first sample word vector sequence and the first sample position vector to the sequence labeling task model, and output a sample sequence labeling result through the sequence labeling task model.
  • Step S605 Calculate a cross-entropy loss value based on the sample labeling label and the sample sequence labeling result, and adjust the sequence labeling task model based on the cross-entropy loss value to obtain an optimized sequence labeling task model.
  • the manually constructed sample is labeled as y label
  • the sample sequence output by the model is labeled as y predict , by minimizing the cross-entropy loss function Just label the task model in the training sequence.
  • the method further includes: additionally constructing a loss function Auxiliary training.
  • I ij is the indicator function
  • x i and x j are the word vectors of two words that are transformed by a fully connected layer, which is the intermediate result of the first transformer block
  • x W*word vector sequence+b
  • W and b are both trainable
  • the model parameter, the dimension is 512*768, and d is the hidden layer dimension. In this example, d is always equal to 768.
  • This application uses sequence labeling to realize the extraction of intentions and the attention mechanism to associate multi-intentional words and non-intentional words, query the analysis of information flow, and can accurately identify multi-intention query sentences, improve accuracy, and improve query efficiency; and Based on the knowledge graph, the results required by the user can be directly returned, which improves the user experience; this application uses the sequence tagging task model to extract the intent, and does not need to maintain a large number of sentence style templates, saving labor costs; and by adding additional attention loss The function guarantees that the accuracy of the model is still sufficient for effective application even with a small training set sample.
  • FIG. 8 shows a schematic diagram of program modules of the data query system of the present application.
  • the data query system 20 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to complete the present invention. Apply, and realize the above-mentioned data query method.
  • the program module referred to in the embodiments of the present application refers to a series of computer program instruction segments capable of completing specific functions, and is more suitable for describing the execution process of the data query system 20 in the storage medium than the program itself. The following description will specifically introduce the functions of each program module in this embodiment:
  • the receiving module 700 is configured to receive a first request, where the first request carries a first original sentence.
  • the sequence labeling module 710 is configured to classify the first original sentence and generate a sequence labeling result.
  • the first generating module 720 is configured to obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result.
  • the second generating module 730 is configured to generate multiple intent stream analysis results based on the multiple word attention matrices.
  • the query module 740 is configured to query the multiple intent stream analysis results through the knowledge graph library to obtain the query results.
  • the receiving module 700 is further configured to: map the first original sentence into a first identification sequence and a second identification sequence; and map the first identification sequence into a first word vector sequence , Mapping the second identification sequence to a first position vector sequence.
  • the sequence labeling module 710 is further configured to: add the first word vector sequence and the first position vector sequence to the sequence labeling task model by position addition; and label the task based on the sequence
  • the multiple encoders of the model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set; input the vector set into multiple decoders of the sequence labeling task model, based on the multiple
  • the decoder performs decoding and dimensionality reduction processing on the vector set, and outputs a target vector; performs a linear transformation on the target vector through a classifier, and outputs a sequence labeling result.
  • the first generation module 720 is further configured to: obtain the self-attention matrix parameters from the first-layer encoder of the encoder; and generate each parameter based on the self-attention matrix parameters.
  • Self-attention matrix of a word based on the sequence labeling results to obtain multiple target words and the self-attention matrix of each word in each target word; based on the self-attention matrix of each word in each target word, calculate Get the word attention matrix of the corresponding target word.
  • the second generating module 730 is further configured to: take an average value from the word attention matrix of a plurality of the target words, and define the average value as a threshold; The word attention matrix of the word attention matrix is compared with the threshold value to generate a comparison result; based on the comparison result: the target word whose word attention matrix is greater than the threshold value is determined to be an intent related word; based on the sequence labeling result and Intent related words generate multiple intent stream analysis results.
  • the knowledge graph library is stored in the blockchain, and the query module 740 is further configured to: assemble the multiple intent stream analysis results into corresponding second sentences; and identify the The second sentence generates the intent type corresponding to the second sentence; based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
  • the system further includes a training module 750, and the training module 750 is further configured to: obtain a plurality of sample original sentences and sample labeling labels corresponding to the plurality of sample original sentences; A sample of original sentences is mapped to a first sample identification sequence and a second sample identification sequence; the first sample identification sequence is mapped to a first sample word vector sequence, and the second sample identification sequence is mapped to the first sample This position vector; the first sample word vector sequence and the first sample position vector are input to the sequence labeling task model, and the sample sequence labeling result is output through the sequence labeling task model; label and sample sequence are labelled by the sample The labeling result calculates a cross-entropy loss value, and adjusts the sequence labeling task model based on the cross-entropy loss value to obtain an optimized sequence labeling task model.
  • the computer device 2 is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
  • the computer device 2 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers).
  • the computer device 2 at least includes, but is not limited to, a memory 21, a processor 22, a network interface 23, and a data query system 20 that can communicate with each other through a system bus. in:
  • the memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory ( RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
  • the memory 21 may be an internal storage unit of the computer device 2, for example, the hard disk or memory of the computer device 2.
  • the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SMC) equipped on the computer device 2. SD) card, flash card (Flash Card), etc.
  • the memory 21 may also include both the internal storage unit of the computer device 2 and its external storage device.
  • the memory 21 is generally used to store an operating system and various application software installed in the computer device 2, for example, the program code of the data query system 20 in the foregoing embodiment.
  • the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 22 is generally used to control the overall operation of the computer device 2.
  • the processor 22 is used to run the program code or process data stored in the memory 21, for example, to run the data query system 20, so as to implement the data query method of the foregoing embodiment.
  • the network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the computer device 2 and other electronic devices.
  • the network interface 23 is used to connect the computer device 2 with an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal.
  • the network may be Intranet, Internet, Global System of Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G Network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
  • FIG. 9 only shows the computer device 2 with components 20-23, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
  • the data query system 20 stored in the memory 21 may also be divided into one or more program modules.
  • the one or more program modules are stored in the memory 21 and are composed of one or more program modules. It is executed by two processors (the processor 22 in this embodiment) to complete the application.
  • FIG. 8 shows a schematic diagram of program modules for implementing the second embodiment of the data query system 20.
  • the data-based query system 20 can be divided into a receiving module 700, a sequence labeling module 710, and a first generating module.
  • the program module referred to in this application refers to a series of computer program instruction segments that can complete specific functions, and is more suitable than a program to describe the execution process of the data query system 20 in the computer device 2.
  • the specific functions of the program modules 700-740 have been described in detail in the second embodiment, and will not be repeated here.
  • This embodiment also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), only Readable memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which computer programs are stored, The corresponding function is realized when the program is executed by the processor.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium of this embodiment is used to store the data query system 20, and when executed by a processor, it implements the data query method of the foregoing embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Biophysics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The present application relates to the field of big data, and provides a data query method, comprising: receiving a first request carrying a first original statement; classifying the first original statement to generate a sequence annotation result; acquiring a preset self-attention matrix parameter and, on the basis of said self-attention matrix parameter and of the sequence annotation result, generating a plurality of word attention matrices; generating, on the basis of the plurality of word attention matrices, a plurality of intention stream parsing results; querying said intention stream parsing results by means of a knowledge graph library so as to obtain query results. By means of relating multiple-intent words and non-intent words through intent extraction and a self-attention mechanism, the present application effectively resolves the problem of inaccurate query results when multiple intentions are present in an original query statement, thus enhancing query efficiency.

Description

数据查询方法、系统、计算机设备及存储介质Data query method, system, computer equipment and storage medium
本申请要求于2020年9月1日提交中国专利局、申请号为202010905604.6,发明名称为“数据查询方法以及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the Chinese Patent Office on September 1, 2020 with the application number 202010905604.6 and the invention title "Data query method and system", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本申请实施例涉及大数据技术领域,尤其涉及一种数据查询方法、系统、计算机设备及存储介质。The embodiments of the present application relate to the field of big data technology, and in particular, to a data query method, system, computer device, and storage medium.
背景技术Background technique
目前,以搜索引擎为主的基于知识图谱的自动检索一般是通过实体识别替换和文本匹配的方式,首先通过命名实体识别找出实体词进行替换,如用户查询“姚明的身高是多少”时,则查找到[姚明],将[姚明]替换为[名人],查找到[身高],将[身高]替换为[资料],即用户句子转变为“[名人]的[资料]是多少”,然后该句子与后台数据库的样本句通过文本匹配算法进行匹配,成功匹配到“[名人]的[资料]”这个意图,最后在知识图谱数据库中查询人名叫“姚明”,资料为“身高”的属性值即可返回给用户答案。At present, automatic retrieval based on knowledge graphs based on search engines generally uses entity recognition replacement and text matching. First, named entity recognition is used to find entity words for replacement. For example, when a user queries "what is Yao Ming's height", Then it finds [姚明], replaces [姚明] with [Celebrity], finds [身高], and replaces [身高] with [data], that is, the user sentence is transformed into "What is the [data] of [Celebrity]", Then the sentence is matched with the sample sentence in the back-end database through a text matching algorithm, and it is successfully matched to the intention of "[Celebrity]’s [information]". Finally, the person named "Yao Ming" is queried in the knowledge graph database and the data is "Height". The attribute value can then be returned to the user with the answer.
然而,发明人意识到,通过上述意图识别搜索查询的方式需要人工维护大量的样本句,对于多意图的查询句的查询,以及当查询句不符合样本句的模板时,不能返回正确地查询答案。通过上述意图识别搜索查询的方式查询效率低,准确率低。However, the inventor realizes that the above-mentioned intent identification search query method requires manual maintenance of a large number of sample sentences. For queries with multiple intents, and when the query does not match the template of the sample sentence, the correct query answer cannot be returned. . The query efficiency and accuracy rate are low through the above-mentioned intent recognition search query method.
发明内容Summary of the invention
有鉴于此,本申请实施例提供了一种数据查询方法、系统、计算机设备及计算机可读存储介质,用于解决通过上述实体识别和文本匹配的搜索查询的方式查询效率低和准确率低的问题。In view of this, the embodiments of the present application provide a data query method, system, computer equipment, and computer readable storage medium, which are used to solve the problem of low query efficiency and low accuracy through the above-mentioned entity recognition and text matching search query. problem.
本申请实施例是通过下述技术方案来解决上述技术问题:The embodiments of this application solve the above technical problems through the following technical solutions:
一种数据查询方法,包括:A data query method, including:
接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
为了实现上述目的,本申请实施例还提供一种数据查询系统,包括:In order to achieve the foregoing objective, an embodiment of the present application further provides a data query system, including:
接收模块,用于接收第一请求,所述第一请求携带第一原始语句;A receiving module, configured to receive a first request, the first request carrying a first original sentence;
序列标注模块,用于对所述第一原始语句进行分类,生成序列标注结果;The sequence labeling module is used to classify the first original sentence and generate sequence labeling results;
第一生成模块,用于获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;The first generation module is configured to obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
第二生成模块,用于基于所述多个词注意力矩阵生成多个意图流解析结果;The second generation module is configured to generate multiple intent stream analysis results based on the multiple word attention matrices;
查询模块,用于通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。The query module is used to query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
为了实现上述目的,本申请实施例还提供一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时执行以下步骤:In order to achieve the foregoing objective, an embodiment of the present application further provides a computer device. The computer device includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the Perform the following steps in the computer program:
接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
为了实现上述目的,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行以下步骤:In order to achieve the foregoing objective, the embodiments of the present application also provide a computer-readable storage medium having a computer program stored in the computer-readable storage medium, and the computer program may be executed by at least one processor, so that the at least A processor performs the following steps:
接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
本申请实施例提供的数据查询方法、系统、计算机设备及计算机可读存储介质,通过序列标注以实现意图的提取和注意力机制关联多意图词和非意图词,有效解决了原始查询句中多意图的情况下查询结果不准确的问题,提高了查询效率。The data query method, system, computer equipment, and computer-readable storage medium provided by the embodiments of the present application realize the extraction of intentions and the attention mechanism to associate multiple intentional words and non-intentional words through sequence labeling, which effectively solves the multiplicity of original query sentences. The problem of inaccurate query results in the case of intent improves query efficiency.
以下结合附图和具体实施例对本申请进行详细描述,但不作为对本申请的限定。The following describes the application in detail with reference to the accompanying drawings and specific embodiments, but it is not intended to limit the application.
附图说明Description of the drawings
图1为本申请实施例一之数据查询方法的步骤流程图;Fig. 1 is a flow chart of the steps of the data query method according to the first embodiment of the application;
图2为本申请实施例一之数据查询方法中将第一原始语句转化为向量序列的步骤流程图;2 is a flow chart of the steps of converting the first original sentence into a vector sequence in the data query method according to the first embodiment of the application;
图3为本申请实施例一之数据查询方法中生成序列标注结果的步骤流程图;FIG. 3 is a flowchart of the steps of generating sequence labeling results in the data query method according to the first embodiment of the application; FIG.
图4为本申请实施例一之数据查询方法中生成多个词注意力矩阵的步骤流程图;4 is a flowchart of the steps of generating a plurality of word attention matrices in the data query method according to the first embodiment of the application;
图5为本申请实施例一之数据查询方法中生成多个意图流解析结果的步骤流程图;FIG. 5 is a flowchart of steps for generating multiple intent stream analysis results in the data query method according to the first embodiment of the application; FIG.
图6为本申请实施例一之数据查询方法中通过知识图谱库进行查询的步骤流程图;6 is a flow chart of the steps of querying through the knowledge graph database in the data query method of the first embodiment of the application;
图7为本申请实施例一之数据查询方法中训练序列标注任务模型的步骤流程图;FIG. 7 is a flowchart of the steps of training a sequence labeling task model in the data query method according to the first embodiment of the application;
图8为本申请实施例二之数据查询系统的程序模块示意图;FIG. 8 is a schematic diagram of program modules of the data query system according to the second embodiment of the application;
图9为本申请实施例三之计算机设备的硬件结构示意图。FIG. 9 is a schematic diagram of the hardware structure of a computer device according to the third embodiment of the application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions, and advantages of this application clearer and clearer, the following further describes the application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。The technical solutions between the various embodiments can be combined with each other, but they must be based on what can be achieved by a person of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist. It is not within the scope of protection required by this application.
实施例一Example one
请参阅图1,示出了本申请实施例之数据查询方法的步骤流程图。可以理解,本方法实施例中的流程图不用于对执行步骤的顺序进行限定。下面以计算机设备为执行主体进行示例性描述,具体如下:Please refer to FIG. 1, which shows a flowchart of the steps of the data query method according to an embodiment of the present application. It can be understood that the flowchart in this method embodiment is not used to limit the order of execution of the steps. The following is an exemplary description with computer equipment as the main body of execution, and the details are as follows:
如图1所示,所述数据查询方法可以包括步骤S100~S500,其中:As shown in Figure 1, the data query method may include steps S100 to S500, wherein:
步骤S100,接收第一请求,所述第一请求携带第一原始语句。Step S100: Receive a first request, where the first request carries a first original sentence.
在示例性的实施例中,所述第一请求用于请求对所述第一原始语句进行搜索查询。接 收到第一请求之后,获取第一请求中的第一原始语句,将第一原始语句转变为向量序列。In an exemplary embodiment, the first request is used to request a search query for the first original sentence. After receiving the first request, the first original sentence in the first request is obtained, and the first original sentence is converted into a vector sequence.
在示例性的实施例中,如图2所示,所述接收第一请求,所述第一请求携带第一原始语句的步骤S100包括:In an exemplary embodiment, as shown in FIG. 2, the step S100 of receiving the first request, the first request carrying the first original sentence includes:
步骤S101,将所述第一原始语句映射为第一标识序列和第二标识序列。Step S101: Map the first original sentence into a first identification sequence and a second identification sequence.
步骤S102,将所述第一标识序列映射为第一字向量序列,将所述第二标识序列映射为第一位置向量序列。Step S102: Map the first identification sequence to a first word vector sequence, and map the second identification sequence to a first position vector sequence.
在示例性的实施例中,预先设置一个常用字的字表(如字典中常用的2w个字,每个字在字典中对应有一个数字ID),第一标识序列指的是第一原始语句中每个字在字典中对应的数字ID。In an exemplary embodiment, a word list of commonly used words is preset (for example, 2w words commonly used in a dictionary, each word corresponds to a digital ID in the dictionary), and the first identification sequence refers to the first original sentence The numeric ID corresponding to each word in the dictionary.
第一原始语句以“海南航空发行的债券的名称价格以及其控股母公司发行的债券名称”为例,对于该句只有29个字,将29个字映射到数字ID,即[12,23,13,42,56,……],并且对上述数字ID不足的部分补0扩展长度到512,其中,512为模型中默认的句子最大长度,也可以根据实际需求进行更改。句子最大长度以512为例,如果一句话长度大于512,即第一原始语句对应的数字ID超出的部分就截断。即、第一原始语句的第一标识序列为[12,23,13,42,56,0,0,……,0]。上述长度为512的第一标识序列通过embeding(词嵌入)层映射为512*768(参数为bert默认,可改)的第一字向量序列,即将第一标识序列映射为分布式的第一字向量序列。The first original sentence takes "the name price of the bond issued by Hainan Airlines and the name of the bond issued by its holding parent company" as an example. For this sentence, there are only 29 words, and 29 words are mapped to the digital ID, namely [12, 23, 13,42,56,...], and add 0 to extend the length of the above-mentioned insufficient number of IDs to 512, where 512 is the default maximum sentence length in the model, which can also be changed according to actual needs. The maximum length of a sentence is 512 as an example. If the length of a sentence is greater than 512, the excess part of the digital ID corresponding to the first original sentence will be truncated. That is, the first identification sequence of the first original sentence is [12, 23, 13, 42, 56, 0, 0,..., 0]. The above-mentioned first identification sequence with a length of 512 is mapped to a first word vector sequence of 512*768 (the parameter is bert default and can be changed) through the embeding (word embedding) layer, that is, the first identification sequence is mapped to a distributed first word Vector sequence.
进一步地,第二标识序列为第一原始语句中每个字在第一原始语句中的位置ID号,第一位置向量为512*768的位置向量编码。Further, the second identification sequence is the position ID number of each word in the first original sentence in the first original sentence, and the first position vector is a 512*768 position vector code.
在示例性的实施例中,按照如下公式:
Figure PCTCN2020123092-appb-000001
映射为第一位置向量,其中p代表位置ID号,即按照位置对应到[0-511],2i和2i+1分别对应p的偶数和奇数位置,dpos在这里指位置向量维度,即768维。
In an exemplary embodiment, according to the following formula:
Figure PCTCN2020123092-appb-000001
Mapped to the first position vector, where p represents the position ID number, which corresponds to [0-511] according to the position, 2i and 2i+1 correspond to the even and odd positions of p respectively, and dpos here refers to the dimension of the position vector, that is, 768 dimensions .
步骤S200,对所述第一原始语句进行分类,生成序列标注结果。Step S200: Classify the first original sentence, and generate a sequence labeling result.
在示例性的实施例中,可以通过序列标注任务模型对所述第一原始语句进行分类,其中,序列标注任务模型是以bert模型为基础架构的模型。具体的,序列标注任务模型包括编码器和解码器,其中编码器为以bert作为主干的编码器,提取句子特征,隐藏层维度设置为768。编码器输出为512*768维。编码器有6个,每个编码器由结构完全一致的transformer(转换神经网络)块连接而成,其中,每个transformer块都由自注意力层、前馈神经网络层和归一化层组成。将第一字向量序列和第一位置序列按位置相加,并输入序列标注任务模型的编码器中,即可通过多个编码器输出512*768的向量集。In an exemplary embodiment, the first original sentence may be classified by a sequence labeling task model, where the sequence labeling task model is a model based on a bert model. Specifically, the sequence labeling task model includes an encoder and a decoder, where the encoder is an encoder with bert as the backbone, sentence features are extracted, and the hidden layer dimension is set to 768. The encoder output is 512*768 dimensions. There are 6 encoders, and each encoder is connected by a transformer (transformation neural network) block with the same structure. Among them, each transformer block is composed of a self-attention layer, a feedforward neural network layer, and a normalization layer. . The first word vector sequence and the first position sequence are added by position and input into the encoder of the sequence labeling task model, and a 512*768 vector set can be output through multiple encoders.
进一步地,编码器后面跟解码器。每个解码器包括:解码器中的自注意力层、编码-解码注意力层和前向传播神经网络层。解码器还包括512个输出维度为9的全连接层,通过全连接,将编码器最终输出的512*768维向量集降维到512*9维。512对应每个位置,9对应标注的每个种类,其中,标注的每个种类为预先设置的。通过最后一个解码器,每个位置输出一个9维向量,每一维对应一个标注,相加形成一个实数向量,再将该实数向量通过softmax(归一化)层分类后即可得到概率最大的位置,输出序列标注结果。Further, the encoder is followed by the decoder. Each decoder includes: a self-attention layer in the decoder, an encoding-decoding attention layer, and a forward propagation neural network layer. The decoder also includes 512 fully connected layers with an output dimension of 9. Through full connection, the 512*768-dimensional vector set finally output by the encoder is reduced to 512*9 dimensions. 512 corresponds to each position, and 9 corresponds to each type of label, where each type of label is preset. Through the last decoder, each position outputs a 9-dimensional vector, and each dimension corresponds to a label, which is added to form a real number vector, and then the real number vector is classified through the softmax (normalization) layer to obtain the highest probability Position, output sequence labeling result.
在示例性的实施例中,如图3所示,所述对所述第一原始语句进行分类,生成序列标注结果的步骤S200包括:In an exemplary embodiment, as shown in FIG. 3, the step S200 of classifying the first original sentence and generating a sequence labeling result includes:
步骤S201,将所述第一字向量序列和第一位置向量序列按位置相加输入至序列标注任务模型中。In step S201, the first word vector sequence and the first position vector sequence are added into the sequence labeling task model by position addition.
步骤S202,基于所述序列标注任务模型的多个编码器对所述第一字向量序列和第一位置向量序列执行编码,输出向量集。Step S202: A plurality of encoders based on the sequence labeling task model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set.
步骤S203,将所述向量集输入至序列标注任务模型的多个解码器中,基于所述多个解 码器对所述向量集执行解码和降维处理,输出目标向量。Step S203: Input the vector set into multiple decoders of the sequence labeling task model, perform decoding and dimensionality reduction processing on the vector set based on the multiple decoders, and output a target vector.
步骤S204,通过分类器对所述目标向量进行线性变换,输出序列标注结果。Step S204: Perform a linear transformation on the target vector by a classifier, and output a sequence labeling result.
在示例性的实施例中,以“海南航空发行的债券的名称价格以及其控股母公司发行的债券名称”为例,输出序列标注结果为:In an exemplary embodiment, taking "the name price of the bond issued by Hainan Airlines and the name of the bond issued by its holding parent company" as an example, the output sequence labeling result is:
[E_B,E_I,E_I,E_I,A_B,A_I,A_I,A_I,A_I,O,T_B,T_I,T_B,T_I,O,O,R_B,A_B,A_I,A_I,A_I,A_I,A_B,A_I,A_I,A_I,A_I,T_B,T_I]。其中_B代表某个词的句首字,_I代表某个词的其他位置的字,E代表实体entity,A代表属性attribute,T代表意图词target,R代表指代词replace word。该序列标注结果也可以解析为易于理解的形式,即{实体词(知识图谱节点):[“海南航空”],属性词(知识图谱边缘):[“发行的债券”,“控股母公司”,“发型的债券”],指代词:[“其”],意图词:[“名称”,“价格”,“名称”]}。[E_B, E_I, E_I, E_I, A_B, A_I, A_I, A_I, A_I, O, T_B, T_I, T_B, T_I, O, O, R_B, A_B, A_I, A_I, A_I, A_I, A_B, A_I, A_I , A_I, A_I, T_B, T_I]. Among them, _B represents the first character of a certain word, _I represents the characters in other positions of a certain word, E represents entity entity, A represents attribute, T represents intent word target, and R represents replace word. The result of the sequence labeling can also be parsed into an easy-to-understand form, namely {entity word (knowledge graph node): ["Hainan Airlines"], attribute word (knowledge graph edge): ["issued bonds", "holding parent company" ,"The bond of the hairstyle"], the pronoun: ["其"], the intent word: ["name", "price", "name"]}.
步骤S300,获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵。Step S300: Obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result.
在示例性的实施例中,所述自注意力矩阵可以从编码器中的第一层的transformer块进行提取,所述自注意力矩阵是一个对称的512*512的矩阵,可以用以代表字与字之间的相关性。In an exemplary embodiment, the self-attention matrix can be extracted from the transformer block of the first layer in the encoder, and the self-attention matrix is a symmetric 512*512 matrix that can be used to represent characters. Correlation with words.
在示例性的实施例中,如图4所示,所述获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵的步骤S300还可以进一步包括:In an exemplary embodiment, as shown in FIG. 4, the step S300 of acquiring preset self-attention matrix parameters and generating multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result may also be It further includes:
步骤S301,从所述编码器的第一层编码器中获取所述自注意力矩阵参数。Step S301: Obtain the self-attention matrix parameters from the first layer encoder of the encoder.
步骤S302,基于所述自注意力矩阵参数生成每个字的自注意力矩阵。Step S302: Generate a self-attention matrix for each word based on the self-attention matrix parameters.
具体的,每个字的自注意力矩阵为序列标注任务模型中的中间数据。Specifically, the self-attention matrix of each word is the intermediate data in the sequence labeling task model.
进一步地,可以通过相似度公式
Figure PCTCN2020123092-appb-000002
其中,向量Q、K、V为序列标注任务模型的输入向量矩阵与自注意力矩阵参数的乘积得到的。F为字的自注意力矩阵,Q为查询样本向量、K为关键字向量,KT为关键字向量的转置,V为值向量,dk为输入向量的维度。
Further, the similarity formula can be used
Figure PCTCN2020123092-appb-000002
Among them, the vectors Q, K, and V are obtained by multiplying the input vector matrix of the sequence labeling task model and the self-attention matrix parameters. F is the self-attention matrix of the word, Q is the query sample vector, K is the key vector, KT is the transposition of the key vector, V is the value vector, and dk is the dimension of the input vector.
步骤S303,基于序列标注结果获取多个目标词以及每个目标词中的每个字的自注意力矩阵。Step S303: Obtain multiple target words and a self-attention matrix of each character in each target word based on the sequence labeling result.
步骤S304,基于每个目标词中的每个字的自注意力矩阵,计算得到对应的目标词的词注意力矩阵。Step S304: Based on the self-attention matrix of each character in each target word, the word attention matrix of the corresponding target word is calculated.
具体的,将序列标注与所述自注意力矩阵结合,构造成每个词和其他词的词注意力矩阵,来表示词与词之间的相关性。每个词的注意力矩阵为对应每个字的注意力平方和
Figure PCTCN2020123092-appb-000003
相加求平均得到,其中,i表示第i个位置的字,j表示第j个位置的字,aij表示第i个字与第j个字之间的自注意力矩阵,m指的是目标词中字的数量,n指的是第一原始语句中某个词中字的数量。
Specifically, the sequence labeling is combined with the self-attention matrix to construct a word attention matrix of each word and other words to express the relevance between words. The attention matrix of each word is the sum of squared attention corresponding to each word
Figure PCTCN2020123092-appb-000003
Add and average, where i represents the word at the i-th position, j represents the word at the j-th position, aij represents the self-attention matrix between the i-th word and the j-th word, and m refers to the target The number of characters in a word, n refers to the number of characters in a word in the first original sentence.
步骤S400,基于所述多个词注意力矩阵生成多个意图流解析结果。Step S400: Generate multiple intent stream analysis results based on the multiple word attention matrices.
在示例性的实施例中,如图5所示,所述基于所述多个词注意力矩阵生成多个意图流解析结果的步骤S400还可以进一步包括:In an exemplary embodiment, as shown in FIG. 5, the step S400 of generating multiple intent stream analysis results based on the multiple word attention matrices may further include:
步骤S401,从多个所述目标词的词注意力矩阵中取均值,将所述均值定义为阈值。Step S401: Take an average value from the word attention matrix of a plurality of target words, and define the average value as a threshold.
步骤S402,将多个所述目标词的词注意力矩阵与所述阈值进行比对,生成比对结果。In step S402, the word attention matrix of a plurality of the target words is compared with the threshold to generate a comparison result.
步骤S403,基于所述比对结果:确定所述词注意力矩阵大于所述阈值的目标词为意图关联词。Step S403, based on the comparison result: determine that the target word whose word attention matrix is greater than the threshold is an intention-related word.
步骤S404,基于所述序列标注结果和意图关联词生成多个意图流解析结果。Step S404: Generate multiple intent stream analysis results based on the sequence labeling result and the intent related words.
在示例性的实施例中,当所述序列标注结果包含代词时,需要将所述代词替换为与其的词注意力矩阵最高的词。接上例,将多意图流解析结果中的代词替换为与其注意力最高的词,这里即将“其”替换为了“海南航空”。In an exemplary embodiment, when the sequence labeling result contains a pronoun, the pronoun needs to be replaced with the word with the highest word attention matrix. Following the example above, replace the pronouns in the multi-intent stream analysis result with the word with the highest attention. Here, replace "其" with "Hainan Airlines".
在示例性的实施例中,对于上例的第一原始语句中得到的三个意图(两类){1_名称,2_价格,3_名称},分别找到与这三个词满足注意力得分大于M的词,即得到多意图流解析结果{1_名称:[海南航空,发行的债券],2_价格:[海南航空,发行的债券],3_名称:[海南航空,控股母公司,发行的债券]}。In an exemplary embodiment, for the three intentions (two types) {1_name, 2_price, 3_name} obtained in the first original sentence of the above example, find the three words that satisfy the attention For words with a score greater than M, the result of multi-intent flow analysis is obtained {1_Name: [Hainan Airlines, bonds issued], 2_Price: [Hainan Airlines, bonds issued], 3_Name: [Hainan Airlines, controlling parent Company, bonds issued]}.
步骤S500,通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Step S500: Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
在示例性的实施例中,当所述知识图谱表/库为小型知识图谱库/表时,可以直接通过所述当所述知识图谱表/库查询得到查询结果,并将查询结果返回给用户端。相对于传统检索只能返回关联的网页,本申请实施例基于知识图谱,可以直接返回用户需要的结果,提高了用户体验。In an exemplary embodiment, when the knowledge graph table/library is a small knowledge graph library/table, the query result can be obtained directly through the query of the knowledge graph table/library, and the query result is returned to the user end. Compared with the traditional search that can only return related webpages, the embodiments of the present application are based on the knowledge graph and can directly return the results required by the user, which improves the user experience.
在示例性的实施例中,所述知识图谱库存储于区块链中。示例性的,如图6所示,当所述知识图谱表/库为海量知识图谱表/库时,通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果的步骤S500还可以进一步包括:In an exemplary embodiment, the knowledge graph library is stored in a blockchain. Exemplarily, as shown in FIG. 6, when the knowledge graph table/library is a massive knowledge graph table/library, query the multiple intent stream analysis results through the knowledge graph library to obtain the query result S500 It can further include:
步骤S501,将所述多个意图流解析结果分别组装成对应的第二语句。Step S501: Assemble the multiple intention flow analysis results into corresponding second sentences.
步骤S502,识别所述第二语句,生成所述第二语句对应的意图类型。Step S502: Identify the second sentence, and generate an intent type corresponding to the second sentence.
步骤S503,基于所述第二语句的意图类型和所述第二语句在对应的知识图谱库中查询,以得到查询结果。Step S503, based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
具体的,直接用分隔符将多个意图流解析结果进行拼接即可组成多个对应的第二语句,如{1_名称:[海南航空,发行的债券],2_价格:[海南航空,发行的债券],3_名称:[其,控股母公司,发行的债券]},拼接成三句话,例如采用&&&作为分隔符,三句话分别为海南航空&&&发行的债券&&&名称,海南航空&&&发行的债券&&&价格,海南航空(其替换得到)&&&控股母公司&&&发行的债券)。Specifically, multiple intent stream analysis results can be spliced directly with a separator to form multiple corresponding second sentences, such as {1_name: [海南航空, issued bonds], 2_price: [海南航空, Bond issued], 3_ name: [其, holding parent company, bond issued]}, spliced into three sentences, for example, using &&& as a separator, the three sentences are the name of the bond issued by Hainan Airlines &&&, Hainan The price of bonds issued by aviation &&&, and the bonds issued by Hainan Airlines (replaced by it) &&& holding parent company &&&).
具体的,将多意图流识别结果组装成一句话,送到Textcnn(文本分类)模型中进行分类,如意图分为十类:1、查询债券名,2、查询债券价格,3、……,其中意图类别1、2对应知识图谱债券表。Textcnn模型为现有模型,在此不作赘述。Specifically, the multi-intent stream recognition results are assembled into a sentence and sent to the Textcnn (text classification) model for classification. For example, the intents are divided into ten categories: 1. Query the bond name, 2. Query the bond price, 3...., Among them, the intention categories 1 and 2 correspond to the knowledge graph bond table. The Textcnn model is an existing model, so I won’t repeat it here.
在示例性的实施例中,如图7所示,所述方法还包括:In an exemplary embodiment, as shown in FIG. 7, the method further includes:
步骤S601,获取多个样本原始语句以及所述多个样本原始语句对应的样本标注标签。Step S601: Obtain a plurality of sample original sentences and sample label labels corresponding to the plurality of sample original sentences.
步骤S602,将所述多个样本原始语句映射为第一样本标识序列和第二样本标识序列。Step S602: Map the multiple sample original sentences into a first sample identification sequence and a second sample identification sequence.
步骤S603,将所述第一样本标识序列映射为第一样本字向量序列,将所述第二样本标识序列映射为第一样本位置向量。Step S603: Map the first sample identification sequence to a first sample word vector sequence, and map the second sample identification sequence to a first sample position vector.
步骤S604,将所述第一样本字向量序列和第一样本位置向量输入至所述序列标注任务模型,通过所述序列标注任务模型输出样本序列标注结果。Step S604: Input the first sample word vector sequence and the first sample position vector to the sequence labeling task model, and output a sample sequence labeling result through the sequence labeling task model.
步骤S605,通过样本标注标签和样本序列标注结果计算交叉熵损失值,并基于所述交叉熵损失值调整所述序列标注任务模型,以得到优化后的序列标注任务模型。Step S605: Calculate a cross-entropy loss value based on the sample labeling label and the sample sequence labeling result, and adjust the sequence labeling task model based on the cross-entropy loss value to obtain an optimized sequence labeling task model.
具体的,人工构建的样本标注标签为y label,模型输出的样本序列标注结果为y predict,通过最小化交叉熵损失函数
Figure PCTCN2020123092-appb-000004
训练序列标注任务模型即可。
Specifically, the manually constructed sample is labeled as y label , and the sample sequence output by the model is labeled as y predict , by minimizing the cross-entropy loss function
Figure PCTCN2020123092-appb-000004
Just label the task model in the training sequence.
在示例性的实施例中,当样本数据过少训练不足时,所述方法还包括:额外构建一个损失函数
Figure PCTCN2020123092-appb-000005
辅助训练。其中I ij为指示函数,
Figure PCTCN2020123092-appb-000006
x i与x j为两个字的字向量经过一层全连接层变换得到,即是第一个transformer块的中间结果,x=W*字向量序列+b,W和b都是可训练的模型参数,维度为512*768,d为隐藏层维度,本例中d恒等于768。该额外构建的损失函数与上述的最小化交叉熵损失函数L相加,得到最终的损失函数L total=L+L extra,根据最小化交叉熵损失函数的值,进行序列标注任务模型的训练。
In an exemplary embodiment, when the sample data is too small and the training is insufficient, the method further includes: additionally constructing a loss function
Figure PCTCN2020123092-appb-000005
Auxiliary training. Where I ij is the indicator function,
Figure PCTCN2020123092-appb-000006
x i and x j are the word vectors of two words that are transformed by a fully connected layer, which is the intermediate result of the first transformer block, x=W*word vector sequence+b, W and b are both trainable The model parameter, the dimension is 512*768, and d is the hidden layer dimension. In this example, d is always equal to 768. The additionally constructed loss function is added to the aforementioned minimized cross-entropy loss function L to obtain the final loss function L total =L+L extra , and the sequence labeling task model is trained according to the value of the minimized cross-entropy loss function.
本申请通过序列标注以实现意图的提取和注意力机制关联多意图词和非意图词,查询信息流的解析情况,能够准确识别多意图的查询语句,提高了准确率,提高了查询效率;并且基于知识图谱,可以直接返回用户需要的结果,提高了用户体验;本申请采用序列标注任务模型提取意图,不需要对大量的句子样式模板进行维护,节省人力成本;且通过增加额外的注意力损失函数保证模型精度在小训练集样本下依旧足以有效地应用。This application uses sequence labeling to realize the extraction of intentions and the attention mechanism to associate multi-intentional words and non-intentional words, query the analysis of information flow, and can accurately identify multi-intention query sentences, improve accuracy, and improve query efficiency; and Based on the knowledge graph, the results required by the user can be directly returned, which improves the user experience; this application uses the sequence tagging task model to extract the intent, and does not need to maintain a large number of sentence style templates, saving labor costs; and by adding additional attention loss The function guarantees that the accuracy of the model is still sufficient for effective application even with a small training set sample.
实施例二Example two
请继续参阅图8,示出了本申请数据查询系统的程序模块示意图。在本实施例中,数据查询系统20可以包括或被分割成一个或多个程序模块,一个或者多个程序模块被存储于存储介质中,并由一个或多个处理器所执行,以完成本申请,并可实现上述数据查询方法。本申请实施例所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序本身更适合于描述数据查询系统20在存储介质中的执行过程。以下描述将具体介绍本实施例各程序模块的功能:Please continue to refer to FIG. 8, which shows a schematic diagram of program modules of the data query system of the present application. In this embodiment, the data query system 20 may include or be divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to complete the present invention. Apply, and realize the above-mentioned data query method. The program module referred to in the embodiments of the present application refers to a series of computer program instruction segments capable of completing specific functions, and is more suitable for describing the execution process of the data query system 20 in the storage medium than the program itself. The following description will specifically introduce the functions of each program module in this embodiment:
接收模块700,用于接收第一请求,所述第一请求携带第一原始语句。The receiving module 700 is configured to receive a first request, where the first request carries a first original sentence.
序列标注模块710,用于对所述第一原始语句进行分类,生成序列标注结果。The sequence labeling module 710 is configured to classify the first original sentence and generate a sequence labeling result.
第一生成模块720,用于获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵。The first generating module 720 is configured to obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and the sequence labeling result.
第二生成模块730,用于基于所述多个词注意力矩阵生成多个意图流解析结果。The second generating module 730 is configured to generate multiple intent stream analysis results based on the multiple word attention matrices.
查询模块740,用于通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。The query module 740 is configured to query the multiple intent stream analysis results through the knowledge graph library to obtain the query results.
在示例性的实施例中,所述接收模块700还用于:将所述第一原始语句映射为第一标识序列和第二标识序列;将所述第一标识序列映射为第一字向量序列,将所述第二标识序列映射为第一位置向量序列。In an exemplary embodiment, the receiving module 700 is further configured to: map the first original sentence into a first identification sequence and a second identification sequence; and map the first identification sequence into a first word vector sequence , Mapping the second identification sequence to a first position vector sequence.
在示例性的实施例中,所述序列标注模块710还用于:将所述第一字向量序列和第一位置向量序列按位置相加输入至序列标注任务模型中;基于所述序列标注任务模型的多个编码器对所述第一字向量序列和第一位置向量序列执行编码,输出向量集;将所述向量集输入至序列标注任务模型的多个解码器中,基于所述多个解码器对所述向量集执行解码和降维处理,输出目标向量;通过分类器对所述目标向量进行线性变换,输出序列标注结果。In an exemplary embodiment, the sequence labeling module 710 is further configured to: add the first word vector sequence and the first position vector sequence to the sequence labeling task model by position addition; and label the task based on the sequence The multiple encoders of the model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set; input the vector set into multiple decoders of the sequence labeling task model, based on the multiple The decoder performs decoding and dimensionality reduction processing on the vector set, and outputs a target vector; performs a linear transformation on the target vector through a classifier, and outputs a sequence labeling result.
在示例性的实施例中,所述第一生成模块720还用于:从所述编码器的第一层编码器中获取所述自注意力矩阵参数;基于所述自注意力矩阵参数生成每个字的自注意力矩阵;基于序列标注结果获取多个目标词以及每个目标词中的每个字的自注意力矩阵;基于每个目标词中的每个字的自注意力矩阵,计算得到对应的目标词的词注意力矩阵。In an exemplary embodiment, the first generation module 720 is further configured to: obtain the self-attention matrix parameters from the first-layer encoder of the encoder; and generate each parameter based on the self-attention matrix parameters. Self-attention matrix of a word; based on the sequence labeling results to obtain multiple target words and the self-attention matrix of each word in each target word; based on the self-attention matrix of each word in each target word, calculate Get the word attention matrix of the corresponding target word.
在示例性的实施例中,所述第二生成模块730还用于:从多个所述目标词的词注意力矩阵中取均值,将所述均值定义为阈值;将多个所述目标词的词注意力矩阵与所述阈值进行比对,生成比对结果;基于所述比对结果:确定所述词注意力矩阵大于所述阈值的目标词为意图关联词;基于所述序列标注结果和意图关联词生成多个意图流解析结果。In an exemplary embodiment, the second generating module 730 is further configured to: take an average value from the word attention matrix of a plurality of the target words, and define the average value as a threshold; The word attention matrix of the word attention matrix is compared with the threshold value to generate a comparison result; based on the comparison result: the target word whose word attention matrix is greater than the threshold value is determined to be an intent related word; based on the sequence labeling result and Intent related words generate multiple intent stream analysis results.
在示例性的实施例中,所述知识图谱库存储于区块链中,所述查询模块740还用于:将所述多个意图流解析结果分别组装成对应的第二语句;识别所述第二语句,生成所述第二语句对应的意图类型;基于所述第二语句的意图类型和所述第二语句在对应的知识图谱库中查询,以得到查询结果。In an exemplary embodiment, the knowledge graph library is stored in the blockchain, and the query module 740 is further configured to: assemble the multiple intent stream analysis results into corresponding second sentences; and identify the The second sentence generates the intent type corresponding to the second sentence; based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
在示例性的实施例中,所述系统还包括训练模块750,所述训练模块750还用于:获取多个样本原始语句以及所述多个样本原始语句对应的样本标注标签;将所述多个样本原始语句映射为第一样本标识序列和第二样本标识序列;所述第一样本标识序列映射为第一样本字向量序列,将所述第二样本标识序列映射为第一样本位置向量;将所述第一样本字向量序列和第一样本位置向量输入至所述序列标注任务模型,通过所述序列标注任务模型输出样本序列标注结果;通过样本标注标签和样本序列标注结果计算交叉熵损失值,并基于所述交叉熵 损失值调整所述序列标注任务模型,以得到优化后的序列标注任务模型。In an exemplary embodiment, the system further includes a training module 750, and the training module 750 is further configured to: obtain a plurality of sample original sentences and sample labeling labels corresponding to the plurality of sample original sentences; A sample of original sentences is mapped to a first sample identification sequence and a second sample identification sequence; the first sample identification sequence is mapped to a first sample word vector sequence, and the second sample identification sequence is mapped to the first sample This position vector; the first sample word vector sequence and the first sample position vector are input to the sequence labeling task model, and the sample sequence labeling result is output through the sequence labeling task model; label and sample sequence are labelled by the sample The labeling result calculates a cross-entropy loss value, and adjusts the sequence labeling task model based on the cross-entropy loss value to obtain an optimized sequence labeling task model.
实施例三Example three
参阅图9,是本申请实施例三之计算机设备的硬件架构示意图。本实施例中,所述计算机设备2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。该计算机设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图9所示,所述计算机设备2至少包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及数据查询系统20。其中:Refer to FIG. 9, which is a schematic diagram of the hardware architecture of the computer device according to the third embodiment of the present application. In this embodiment, the computer device 2 is a device that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions. The computer device 2 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers). As shown in FIG. 9, the computer device 2 at least includes, but is not limited to, a memory 21, a processor 22, a network interface 23, and a data query system 20 that can communicate with each other through a system bus. in:
本实施例中,存储器21至少包括一种类型的计算机可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器21可以是计算机设备2的内部存储单元,例如该计算机设备2的硬盘或内存。在另一些实施例中,存储器21也可以是计算机设备2的外部存储设备,例如该计算机设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器21还可以既包括计算机设备2的内部存储单元也包括其外部存储设备。本实施例中,存储器21通常用于存储安装于计算机设备2的操作系统和各类应用软件,例如上述实施例的数据查询系统20的程序代码等。此外,存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。In this embodiment, the memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory ( RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, optical disks, etc. In some embodiments, the memory 21 may be an internal storage unit of the computer device 2, for example, the hard disk or memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SMC) equipped on the computer device 2. SD) card, flash card (Flash Card), etc. Of course, the memory 21 may also include both the internal storage unit of the computer device 2 and its external storage device. In this embodiment, the memory 21 is generally used to store an operating system and various application software installed in the computer device 2, for example, the program code of the data query system 20 in the foregoing embodiment. In addition, the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制计算机设备2的总体操作。本实施例中,处理器22用于运行存储器21中存储的程序代码或者处理数据,例如运行数据查询系统20,以实现上述实施例的数据查询方法。In some embodiments, the processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 22 is generally used to control the overall operation of the computer device 2. In this embodiment, the processor 22 is used to run the program code or process data stored in the memory 21, for example, to run the data query system 20, so as to implement the data query method of the foregoing embodiment.
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述计算机设备2与其他电子装置之间建立通信连接。例如,所述网络接口23用于通过网络将所述计算机设备2与外部终端相连,在所述计算机设备2与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。The network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the computer device 2 and other electronic devices. For example, the network interface 23 is used to connect the computer device 2 with an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal. The network may be Intranet, Internet, Global System of Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G Network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
需要指出的是,图9仅示出了具有部件20-23的计算机设备2,但是应理解的是,并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。It should be pointed out that FIG. 9 only shows the computer device 2 with components 20-23, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
在本实施例中,存储于存储器21中的所述数据查询系统20还可以被分割为一个或者多个程序模块,所述一个或者多个程序模块被存储于存储器21中,并由一个或多个处理器(本实施例为处理器22)所执行,以完成本申请。In this embodiment, the data query system 20 stored in the memory 21 may also be divided into one or more program modules. The one or more program modules are stored in the memory 21 and are composed of one or more program modules. It is executed by two processors (the processor 22 in this embodiment) to complete the application.
例如,图8示出了所述实现数据查询系统20实施例二的程序模块示意图,该实施例中,所述基于数据查询系统20可以被划分为接收模块700、序列标注模块710、第一生成模块720、第二生成模块730以及查询莫夸740。其中,本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述数据查询系统20在所述计算机设备2中的执行过程。所述程序模块700-740的具体功能在实施例二中已有详细描述,在此不再赘述。For example, FIG. 8 shows a schematic diagram of program modules for implementing the second embodiment of the data query system 20. In this embodiment, the data-based query system 20 can be divided into a receiving module 700, a sequence labeling module 710, and a first generating module. The module 720, the second generation module 730, and the query moqua 740. Among them, the program module referred to in this application refers to a series of computer program instruction segments that can complete specific functions, and is more suitable than a program to describe the execution process of the data query system 20 in the computer device 2. The specific functions of the program modules 700-740 have been described in detail in the second embodiment, and will not be repeated here.
实施例四Example four
本实施例还提供一种计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例 如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机程序,程序被处理器执行时实现相应功能。所述计算机可读存储介质可以是非易失性,也可以是易失性。本实施例的计算机可读存储介质用于存储数据查询系统20,被处理器执行时实现上述实施例的数据查询方法。This embodiment also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), only Readable memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which computer programs are stored, The corresponding function is realized when the program is executed by the processor. The computer-readable storage medium may be non-volatile or volatile. The computer-readable storage medium of this embodiment is used to store the data query system 20, and when executed by a processor, it implements the data query method of the foregoing embodiment.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the foregoing embodiments of the present application are for description only, and do not represent the superiority or inferiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of the application, and do not limit the scope of the patent for this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of the application, or directly or indirectly applied to other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种数据查询方法,其中,包括:A data query method, which includes:
    接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
    对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
    获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
    基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
    通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  2. 根据权利要求1所述的数据查询方法,其中,所述接收第一请求,所述第一请求携带第一原始语句包括:The data query method according to claim 1, wherein the receiving the first request, the first request carrying the first original sentence comprises:
    将所述第一原始语句映射为第一标识序列和第二标识序列;Mapping the first original sentence into a first identification sequence and a second identification sequence;
    将所述第一标识序列映射为第一字向量序列,将所述第二标识序列映射为第一位置向量序列。The first identification sequence is mapped to a first word vector sequence, and the second identification sequence is mapped to a first position vector sequence.
  3. 根据权利要求2所述的数据查询方法,其中,所述对所述第一原始语句进行分类,生成序列标注结果包括:The data query method according to claim 2, wherein said classifying said first original sentence and generating a sequence labeling result comprises:
    将所述第一字向量序列和第一位置向量序列按位置相加输入至序列标注任务模型中;Inputting the first word vector sequence and the first position vector sequence into the sequence labeling task model by position addition;
    基于所述序列标注任务模型的多个编码器对所述第一字向量序列和第一位置向量序列执行编码,输出向量集;A plurality of encoders based on the sequence labeling task model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set;
    将所述向量集输入至序列标注任务模型的多个解码器中,基于所述多个解码器对所述向量集执行解码和降维处理,输出目标向量;Inputting the vector set into multiple decoders of a sequence labeling task model, and performing decoding and dimensionality reduction processing on the vector set based on the multiple decoders, and outputting a target vector;
    通过分类器对所述目标向量进行线性变换,输出序列标注结果。The target vector is linearly transformed by the classifier, and the sequence labeling result is output.
  4. 根据权利要求3所述的数据查询方法,其中,所述获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵包括:The data query method according to claim 3, wherein said acquiring preset self-attention matrix parameters and generating a plurality of word attention matrices based on said self-attention matrix parameters and sequence labeling results comprises:
    从所述编码器的第一层编码器中获取所述自注意力矩阵参数;Acquiring the self-attention matrix parameter from the first layer encoder of the encoder;
    基于所述自注意力矩阵参数生成每个字的自注意力矩阵;Generating a self-attention matrix for each word based on the self-attention matrix parameters;
    基于序列标注结果获取多个目标词以及每个目标词中的每个字的自注意力矩阵;Obtain the self-attention matrix of multiple target words and each character in each target word based on the sequence labeling result;
    基于每个目标词中的每个字的自注意力矩阵,计算得到对应的目标词的词注意力矩阵。Based on the self-attention matrix of each character in each target word, the word attention matrix of the corresponding target word is calculated.
  5. 根据权利要求4所述的数据查询方法,其中,所述基于所述多个词注意力矩阵生成多个意图流解析结果包括:The data query method according to claim 4, wherein said generating a plurality of intent stream parsing results based on the plurality of word attention matrices comprises:
    从多个所述目标词的词注意力矩阵中取均值,将所述均值定义为阈值;Taking an average value from the word attention matrix of a plurality of the target words, and defining the average value as a threshold;
    将多个所述目标词的词注意力矩阵与所述阈值进行比对,生成比对结果;Comparing word attention matrices of a plurality of the target words with the threshold to generate a comparison result;
    基于所述比对结果:确定所述词注意力矩阵大于所述阈值的目标词为意图关联词;Based on the comparison result: determining that the target word whose word attention matrix is greater than the threshold is an intent-related word;
    基于所述序列标注结果和意图关联词生成多个意图流解析结果。A plurality of intent stream analysis results are generated based on the sequence labeling result and the intent related words.
  6. 根据权利要求1所述的数据查询方法,其中,所述知识图谱库存储于区块链中,通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果还包括:The data query method according to claim 1, wherein the knowledge graph library is stored in a blockchain, and querying the multiple intent stream analysis results through the knowledge graph library to obtain the query result further comprises:
    将所述多个意图流解析结果分别组装成对应的第二语句;Assembling the plurality of intent stream parsing results into corresponding second sentences;
    识别所述第二语句,生成所述第二语句对应的意图类型;Identifying the second sentence, and generating an intent type corresponding to the second sentence;
    基于所述第二语句的意图类型和所述第二语句在对应的知识图谱库中查询,以得到查询结果。Based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
  7. 根据权利要求1所述的数据查询方法,其中,所述方法还包括:The data query method according to claim 1, wherein the method further comprises:
    获取多个样本原始语句以及所述多个样本原始语句对应的样本标注标签;Acquiring a plurality of sample original sentences and sample labeling labels corresponding to the plurality of sample original sentences;
    将所述多个样本原始语句映射为第一样本标识序列和第二样本标识序列;Mapping the multiple sample original sentences into a first sample identification sequence and a second sample identification sequence;
    将所述第一样本标识序列映射为第一样本字向量序列,将所述第二样本标识序列映射为第一样本位置向量;Mapping the first sample identification sequence to a first sample word vector sequence, and mapping the second sample identification sequence to a first sample position vector;
    将所述第一样本字向量序列和第一样本位置向量输入至所述序列标注任务模型,通过所述序列标注任务模型输出样本序列标注结果;Inputting the first sample word vector sequence and the first sample position vector to the sequence labeling task model, and outputting a sample sequence labeling result through the sequence labeling task model;
    通过样本标注标签和样本序列标注结果计算交叉熵损失值,并基于所述交叉熵损失值调整所述序列标注任务模型,以得到优化后的序列标注任务模型。The cross-entropy loss value is calculated according to the sample labeling label and the sample sequence labeling result, and the sequence labeling task model is adjusted based on the cross entropy loss value to obtain an optimized sequence labeling task model.
  8. 一种数据查询系统,其中,包括:A data query system, which includes:
    接收模块,用于接收第一请求,所述第一请求携带第一原始语句;A receiving module, configured to receive a first request, the first request carrying a first original sentence;
    序列标注模块,用于对所述第一原始语句进行分类,生成序列标注结果;The sequence labeling module is used to classify the first original sentence and generate sequence labeling results;
    第一生成模块,用于获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;The first generation module is configured to obtain preset self-attention matrix parameters, and generate multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
    第二生成模块,用于基于所述多个词注意力矩阵生成多个意图流解析结果;The second generation module is configured to generate multiple intent stream analysis results based on the multiple word attention matrices;
    查询模块,用于通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。The query module is used to query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  9. 一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时执行以下步骤:A computer device includes a memory, a processor, and a computer program that is stored on the memory and can run on the processor, wherein the processor executes the following steps when the computer program is executed:
    接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
    对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
    获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
    基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
    通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  10. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer device according to claim 9, wherein the processor executes the following steps when executing the computer program:
    将所述第一原始语句映射为第一标识序列和第二标识序列;Mapping the first original sentence into a first identification sequence and a second identification sequence;
    将所述第一标识序列映射为第一字向量序列,将所述第二标识序列映射为第一位置向量序列。The first identification sequence is mapped to a first word vector sequence, and the second identification sequence is mapped to a first position vector sequence.
  11. 根据权利要求10所述的计算机设备,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer device according to claim 10, wherein the processor executes the following steps when executing the computer program:
    将所述第一字向量序列和第一位置向量序列按位置相加输入至序列标注任务模型中;Inputting the first word vector sequence and the first position vector sequence into the sequence labeling task model by position addition;
    基于所述序列标注任务模型的多个编码器对所述第一字向量序列和第一位置向量序列执行编码,输出向量集;A plurality of encoders based on the sequence labeling task model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set;
    将所述向量集输入至序列标注任务模型的多个解码器中,基于所述多个解码器对所述向量集执行解码和降维处理,输出目标向量;Inputting the vector set into multiple decoders of a sequence labeling task model, and performing decoding and dimensionality reduction processing on the vector set based on the multiple decoders, and outputting a target vector;
    通过分类器对所述目标向量进行线性变换,输出序列标注结果。The target vector is linearly transformed by the classifier, and the sequence labeling result is output.
  12. 根据权利要求11所述的计算机设备,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer device according to claim 11, wherein the processor executes the following steps when executing the computer program:
    从所述编码器的第一层编码器中获取所述自注意力矩阵参数;Acquiring the self-attention matrix parameter from the first layer encoder of the encoder;
    基于所述自注意力矩阵参数生成每个字的自注意力矩阵;Generating a self-attention matrix for each word based on the self-attention matrix parameters;
    基于序列标注结果获取多个目标词以及每个目标词中的每个字的自注意力矩阵;Obtain the self-attention matrix of multiple target words and each character in each target word based on the sequence labeling result;
    基于每个目标词中的每个字的自注意力矩阵,计算得到对应的目标词的词注意力矩阵。Based on the self-attention matrix of each character in each target word, the word attention matrix of the corresponding target word is calculated.
  13. 根据权利要求12所述的计算机设备,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer device according to claim 12, wherein the processor executes the following steps when executing the computer program:
    从多个所述目标词的词注意力矩阵中取均值,将所述均值定义为阈值;Taking an average value from the word attention matrix of a plurality of the target words, and defining the average value as a threshold;
    将多个所述目标词的词注意力矩阵与所述阈值进行比对,生成比对结果;Comparing word attention matrices of a plurality of the target words with the threshold to generate a comparison result;
    基于所述比对结果:确定所述词注意力矩阵大于所述阈值的目标词为意图关联词;Based on the comparison result: determining that the target word whose word attention matrix is greater than the threshold is an intent-related word;
    基于所述序列标注结果和意图关联词生成多个意图流解析结果。A plurality of intent stream analysis results are generated based on the sequence labeling result and the intent related words.
  14. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer device according to claim 9, wherein the processor executes the following steps when executing the computer program:
    将所述多个意图流解析结果分别组装成对应的第二语句;Assembling the plurality of intent stream parsing results into corresponding second sentences;
    识别所述第二语句,生成所述第二语句对应的意图类型;Identifying the second sentence, and generating an intent type corresponding to the second sentence;
    基于所述第二语句的意图类型和所述第二语句在对应的知识图谱库中查询,以得到查询结果。Based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质内存储有计算机程序,所述计算机程序可被至少一个处理器所执行,以使所述至少一个处理器执行以下步骤:A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and the computer program can be executed by at least one processor, so that the at least one processor executes the following steps:
    接收第一请求,所述第一请求携带第一原始语句;Receiving a first request, the first request carrying a first original sentence;
    对所述第一原始语句进行分类,生成序列标注结果;Classify the first original sentence, and generate a sequence labeling result;
    获取预设的自注意力矩阵参数,基于所述自注意力矩阵参数和序列标注结果生成多个词注意力矩阵;Acquiring preset self-attention matrix parameters, and generating multiple word attention matrices based on the self-attention matrix parameters and sequence labeling results;
    基于所述多个词注意力矩阵生成多个意图流解析结果;Generating multiple intent stream analysis results based on the multiple word attention matrices;
    通过知识图谱库对所述多个意图流解析结果进行查询,以得到查询结果。Query the analysis results of the multiple intent streams through the knowledge graph library to obtain the query results.
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer-readable storage medium according to claim 15, wherein the processor executes the following steps when executing the computer program:
    求携带第一原始语句包括:Request to carry the first original sentence includes:
    将所述第一原始语句映射为第一标识序列和第二标识序列;Mapping the first original sentence into a first identification sequence and a second identification sequence;
    将所述第一标识序列映射为第一字向量序列,将所述第二标识序列映射为第一位置向量序列。The first identification sequence is mapped to a first word vector sequence, and the second identification sequence is mapped to a first position vector sequence.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer-readable storage medium according to claim 16, wherein the processor executes the following steps when executing the computer program:
    将所述第一字向量序列和第一位置向量序列按位置相加输入至序列标注任务模型中;Inputting the first word vector sequence and the first position vector sequence into the sequence labeling task model by position addition;
    基于所述序列标注任务模型的多个编码器对所述第一字向量序列和第一位置向量序列执行编码,输出向量集;A plurality of encoders based on the sequence labeling task model perform encoding on the first word vector sequence and the first position vector sequence, and output a vector set;
    将所述向量集输入至序列标注任务模型的多个解码器中,基于所述多个解码器对所述向量集执行解码和降维处理,输出目标向量;Inputting the vector set into multiple decoders of a sequence labeling task model, and performing decoding and dimensionality reduction processing on the vector set based on the multiple decoders, and outputting a target vector;
    通过分类器对所述目标向量进行线性变换,输出序列标注结果。The target vector is linearly transformed by the classifier, and the sequence labeling result is output.
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer-readable storage medium according to claim 17, wherein the processor executes the following steps when executing the computer program:
    从所述编码器的第一层编码器中获取所述自注意力矩阵参数;Acquiring the self-attention matrix parameter from the first layer encoder of the encoder;
    基于所述自注意力矩阵参数生成每个字的自注意力矩阵;Generating a self-attention matrix for each word based on the self-attention matrix parameters;
    基于序列标注结果获取多个目标词以及每个目标词中的每个字的自注意力矩阵;Obtain the self-attention matrix of multiple target words and each character in each target word based on the sequence labeling result;
    基于每个目标词中的每个字的自注意力矩阵,计算得到对应的目标词的词注意力矩阵。Based on the self-attention matrix of each character in each target word, the word attention matrix of the corresponding target word is calculated.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer-readable storage medium according to claim 18, wherein the processor executes the following steps when executing the computer program:
    从多个所述目标词的词注意力矩阵中取均值,将所述均值定义为阈值;Taking an average value from the word attention matrix of a plurality of the target words, and defining the average value as a threshold;
    将多个所述目标词的词注意力矩阵与所述阈值进行比对,生成比对结果;Comparing word attention matrices of a plurality of the target words with the threshold to generate a comparison result;
    基于所述比对结果:确定所述词注意力矩阵大于所述阈值的目标词为意图关联词;Based on the comparison result: determining that the target word whose word attention matrix is greater than the threshold is an intent-related word;
    基于所述序列标注结果和意图关联词生成多个意图流解析结果。A plurality of intent stream analysis results are generated based on the sequence labeling result and the intent related words.
  20. 根据权利要求15所述的计算机可读存储介质,其中,所述处理器执行所述计算机程序时执行以下步骤:The computer-readable storage medium according to claim 15, wherein the processor executes the following steps when executing the computer program:
    将所述多个意图流解析结果分别组装成对应的第二语句;Assembling the plurality of intent stream parsing results into corresponding second sentences;
    识别所述第二语句,生成所述第二语句对应的意图类型;Identifying the second sentence, and generating an intent type corresponding to the second sentence;
    基于所述第二语句的意图类型和所述第二语句在对应的知识图谱库中查询,以得到查询结果。Based on the intent type of the second sentence and the second sentence, query in the corresponding knowledge graph database to obtain the query result.
PCT/CN2020/123092 2020-09-01 2020-10-23 Data query method and system, computer device, and storage medium WO2021174871A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010905604.6A CN112035645B (en) 2020-09-01 2020-09-01 Data query method and system
CN202010905604.6 2020-09-01

Publications (1)

Publication Number Publication Date
WO2021174871A1 true WO2021174871A1 (en) 2021-09-10

Family

ID=73590913

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/123092 WO2021174871A1 (en) 2020-09-01 2020-10-23 Data query method and system, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN112035645B (en)
WO (1) WO2021174871A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113761207A (en) * 2021-09-14 2021-12-07 广州汇通国信科技有限公司 Power grid data classification method and device based on textCNN model and knowledge graph
CN114494791A (en) * 2022-04-06 2022-05-13 之江实验室 Attention selection-based transformer operation simplification method and device
CN118113815A (en) * 2024-04-22 2024-05-31 腾讯科技(深圳)有限公司 Content searching method, related device and medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113590779B (en) * 2021-06-30 2023-04-25 四川大学 Construction method of intelligent question-answering system of knowledge graph in air traffic control field
CN113821533B (en) * 2021-09-30 2023-09-08 北京鲸鹳科技有限公司 Method, device, equipment and storage medium for data query
CN115690552A (en) * 2022-12-30 2023-02-03 智慧眼科技股份有限公司 Multi-intention recognition method and device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446286A (en) * 2017-02-16 2018-08-24 阿里巴巴集团控股有限公司 A kind of generation method, device and the server of the answer of natural language question sentence
CN109885698A (en) * 2019-02-13 2019-06-14 北京航空航天大学 A kind of knowledge mapping construction method and device, electronic equipment
CN111177393A (en) * 2020-01-02 2020-05-19 广东博智林机器人有限公司 Knowledge graph construction method and device, electronic equipment and storage medium
US20200175015A1 (en) * 2018-11-29 2020-06-04 Koninklijke Philips N.V. Crf-based span prediction for fine machine learning comprehension

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019046463A1 (en) * 2017-08-29 2019-03-07 Zhoa Tiancheng System and method for defining dialog intents and building zero-shot intent recognition models
KR101924215B1 (en) * 2018-01-18 2018-11-30 주식회사 머니브레인 Method of generating a dialogue template for conversation understainding ai service system having a goal, and computer readable recording medium
CN108364023A (en) * 2018-02-11 2018-08-03 北京达佳互联信息技术有限公司 Image-recognizing method based on attention model and system
CN109597994B (en) * 2018-12-04 2023-06-06 挖财网络技术有限公司 Short text problem semantic matching method and system
CN110543566B (en) * 2019-09-06 2022-07-22 上海海事大学 Intention classification method based on self-attention neighbor relation coding
CN111552821B (en) * 2020-05-14 2022-03-01 北京华宇元典信息服务有限公司 Legal intention searching method, legal intention searching device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446286A (en) * 2017-02-16 2018-08-24 阿里巴巴集团控股有限公司 A kind of generation method, device and the server of the answer of natural language question sentence
US20200175015A1 (en) * 2018-11-29 2020-06-04 Koninklijke Philips N.V. Crf-based span prediction for fine machine learning comprehension
CN109885698A (en) * 2019-02-13 2019-06-14 北京航空航天大学 A kind of knowledge mapping construction method and device, electronic equipment
CN111177393A (en) * 2020-01-02 2020-05-19 广东博智林机器人有限公司 Knowledge graph construction method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113761207A (en) * 2021-09-14 2021-12-07 广州汇通国信科技有限公司 Power grid data classification method and device based on textCNN model and knowledge graph
CN114494791A (en) * 2022-04-06 2022-05-13 之江实验室 Attention selection-based transformer operation simplification method and device
CN114494791B (en) * 2022-04-06 2022-07-08 之江实验室 Attention selection-based transformer operation simplification method and device
CN118113815A (en) * 2024-04-22 2024-05-31 腾讯科技(深圳)有限公司 Content searching method, related device and medium

Also Published As

Publication number Publication date
CN112035645A (en) 2020-12-04
CN112035645B (en) 2024-06-11

Similar Documents

Publication Publication Date Title
WO2021174871A1 (en) Data query method and system, computer device, and storage medium
CN109145294B (en) Text entity identification method and device, electronic equipment and storage medium
WO2021051560A1 (en) Text classification method and apparatus, electronic device, and computer non-volatile readable storage medium
WO2021135469A1 (en) Machine learning-based information extraction method, apparatus, computer device, and medium
WO2021121198A1 (en) Semantic similarity-based entity relation extraction method and apparatus, device and medium
WO2022083094A1 (en) Text semantic recognition method and apparatus, electronic device, and storage medium
CN117076653B (en) Knowledge base question-answering method based on thinking chain and visual lifting context learning
CN111832293B (en) Entity and relation joint extraction method based on head entity prediction
CN111475617A (en) Event body extraction method and device and storage medium
CN110597961A (en) Text category labeling method and device, electronic equipment and storage medium
CN113377897B (en) Multi-language medical term standard standardization system and method based on deep confrontation learning
CN113987169A (en) Text abstract generation method, device and equipment based on semantic block and storage medium
CN112417823B (en) Chinese text word order adjustment and word completion method and system
CN115827819A (en) Intelligent question and answer processing method and device, electronic equipment and storage medium
CN116303537A (en) Data query method and device, electronic equipment and storage medium
CN113673228A (en) Text error correction method, text error correction device, computer storage medium and computer program product
CN115687621A (en) Short text label labeling method and device
KR102608867B1 (en) Method for industry text increment, apparatus thereof, and computer program stored in medium
CN113705222B (en) Training method and device for slot identification model and slot filling method and device
CN112036186A (en) Corpus labeling method and device, computer storage medium and electronic equipment
CN112287657A (en) Information matching system based on text similarity
CN112016299A (en) Method and device for generating dependency syntax tree by using neural network executed by computer
CN115906854A (en) Multi-level confrontation-based cross-language named entity recognition model training method
CN113688615B (en) Method, equipment and storage medium for generating field annotation and understanding character string
WO2021135103A1 (en) Method and apparatus for semantic analysis, computer device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20922824

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20922824

Country of ref document: EP

Kind code of ref document: A1