CN113821622B - Answer retrieval method and device based on artificial intelligence, electronic equipment and medium - Google Patents

Answer retrieval method and device based on artificial intelligence, electronic equipment and medium Download PDF

Info

Publication number
CN113821622B
CN113821622B CN202111149209.0A CN202111149209A CN113821622B CN 113821622 B CN113821622 B CN 113821622B CN 202111149209 A CN202111149209 A CN 202111149209A CN 113821622 B CN113821622 B CN 113821622B
Authority
CN
China
Prior art keywords
vector
question
answer
similarity
semantic
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111149209.0A
Other languages
Chinese (zh)
Other versions
CN113821622A (en
Inventor
史文鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111149209.0A priority Critical patent/CN113821622B/en
Publication of CN113821622A publication Critical patent/CN113821622A/en
Application granted granted Critical
Publication of CN113821622B publication Critical patent/CN113821622B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/3349Reuse of stored results of previous queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the field of artificial intelligence, and discloses an answer retrieval method based on artificial intelligence, which comprises the following steps: receiving a problem sentence input by a user on a search platform, generating a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extracting the semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model; matching problem vectors of semantic vectors from a pre-constructed vector database; searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking the timeliness of the question answer; when the timeliness meets the preset condition, returning the answer to the question to the user; and when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user. In addition, the application also relates to a blockchain technology, and answers to the questions can be stored in the blockchain. The application can improve the recognition capability of the question semantics and realize the enhancement of the retrieval efficiency of the question answers.

Description

Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
Technical Field
The present application relates to the field of artificial intelligence, and in particular, to an answer retrieval method, an answer retrieval device, an electronic device and a computer readable storage medium based on artificial intelligence.
Background
With the rapid development of the internet, many intelligent search platforms are presented, and users input questions in the search platforms, so that the search platforms return corresponding answers to the questions. However, in the actual business scenario, because the expression forms of the users are different, the text content of the input questions can deviate, for example, a question one "bank card handling channel" and a question two "how to apply for a debit card" exist, although the two questions are completely different in terms of words, the two questions have the same semantics, so that the phenomenon that the questions with the same semantics and without the same text content need to be repeatedly solved easily occurs, therefore, in the process of searching the answers of the questions by the users, how to accurately identify the semantics of the questions of the search questions, so that the questions with the same semantics can be quickly identified, and the improvement of the search efficiency of the answers of the questions is the question to be solved urgently at present.
Disclosure of Invention
The application provides an answer retrieval method, an answer retrieval device, electronic equipment and a computer readable storage medium based on artificial intelligence, which mainly aim to improve the recognition capability of the problem semantics and realize the enhancement of the retrieval efficiency of the problem answers.
In order to achieve the above object, the present application provides an answer retrieval method based on artificial intelligence, comprising:
receiving a problem sentence input by a user on a search platform, generating a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extracting a semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model;
matching the problem vector of the semantic vector from a pre-constructed vector database;
searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking the timeliness of the question answer;
when the timeliness meets a preset condition, returning the answer to the question to the user;
and when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user.
Optionally, before the generating the similar sentence vector of the problem sentence by using the vector generating mechanism in the trained semantic recognition model, the method further includes:
acquiring a training corpus, wherein the training corpus comprises training sentences and corresponding real similar sentences;
inputting the training corpus into a vector generation mechanism in a pre-constructed semantic recognition model to output a prediction similar sentence vector of the training corpus, and calculating a first similarity loss of the prediction similar sentence vector and a corresponding real similar sentence by using a loss function in the vector generation mechanism;
calculating second similar loss of the prediction similar sentence vector and the corresponding training sentence by utilizing a semantic recognition mechanism in the pre-constructed semantic recognition model;
calculating the final similarity loss of the pre-constructed semantic recognition model according to the first similarity loss and the second similarity loss;
if the final similarity loss is larger than the preset similarity loss, readjusting parameters of the pre-constructed semantic recognition model, and returning to the step of executing the vector generation mechanism for inputting the training corpus into the pre-constructed semantic recognition model;
and if the final similarity loss is not greater than the preset similarity loss, obtaining a trained semantic recognition model.
Optionally, the inputting the training corpus into a vector generation mechanism in a pre-constructed semantic recognition model to output a prediction similarity sentence vector of the training corpus includes:
performing position vector coding on the training corpus by using an encoder in the vector generation mechanism to obtain a coded vector corpus;
masking the coded vector corpus by using a masking layer in the vector generation mechanism to obtain a masking vector corpus;
and performing sequence decoding on the mask vector corpus by using a decoder in the vector generation mechanism to obtain a prediction similarity statement vector of the training corpus.
Optionally, the calculating, by using a semantic recognition mechanism in the pre-constructed semantic recognition model, the second similarity loss between the prediction similarity statement vector and the training statement corresponding to the prediction similarity statement vector includes:
constructing a sentence vector matrix of the prediction similarity sentence vector, and normalizing the sentence vector matrix to obtain a normalized vector matrix;
performing inner product on the normalized vector matrix to obtain a similarity vector matrix, and performing dimension expansion on the similarity vector matrix to obtain a high-dimensional similarity vector matrix;
and calculating second similar losses of the high-dimensional similarity vector matrix and the corresponding training sentences by using a loss function in the semantic recognition mechanism.
Optionally, the loss function in the semantic recognition mechanism includes:
where loss2 represents a second similarity loss, b represents the number of samples of the predicted similarity statement vector, y (x i ) A vector representing the training statement is presented,representing a high-dimensional similarity vector matrix.
Optionally, the matching the problem vector of the semantic vector from the pre-constructed vector database includes:
and calculating the similarity between the semantic vector and the vector in the pre-constructed vector database, and taking the vector with the similarity larger than the preset similarity as the problem vector of the semantic vector.
Optionally, the searching the question answers of the question vector from the pre-constructed question-answer knowledge base includes:
and matching the question fields in the pre-constructed question-answer knowledge base according to the vector fields of the question vectors, and taking the answers corresponding to the successfully matched question fields as the question answers of the question vectors.
In order to solve the above problems, the present application further provides an answer retrieval device based on artificial intelligence, the device comprising:
the semantic vector recognition module is used for receiving a problem statement input by a user on a search platform, generating a similar statement vector of the problem statement by using a vector generation mechanism in a trained semantic recognition model, and extracting the semantic vector of the problem statement from the similar statement vector by using a semantic recognition mechanism in the trained semantic recognition model;
the problem vector matching module is used for matching the problem vector of the semantic vector from a pre-constructed vector database;
the question answer searching module is used for searching the question answers of the question vectors from a pre-constructed question answer knowledge base and verifying the timeliness of the question answers;
the question answer returning module is used for returning the question answer to the user when the timeliness meets a preset condition;
and the question answer returning module is further configured to update the answer of the question vector and return the answer to the user when the timeliness does not meet the preset condition.
In order to solve the above-mentioned problems, the present application also provides an electronic apparatus including:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to implement the artificial intelligence based answer retrieval method described above.
In order to solve the above-mentioned problems, the present application also provides a computer-readable storage medium having stored therein at least one computer program that is executed by a processor in an electronic device to implement the above-mentioned answer retrieval method based on artificial intelligence.
It can be seen that, according to the embodiment of the application, the semantic feature extraction is performed on the question sentences input by the user through the trained semantic recognition model, so that the question sentences have a vector semantic representation form, the literal semantic representation of the question sentences is avoided, the deeper semantic representation of the question sentences is realized, further, the questions with the same semantics and without the same text content can be rapidly recognized and matched, and the question vectors of the semantic vectors are matched from the vector database, so that the search of the question answers of the question vectors in the question and answer knowledge base is realized, the phenomenon that the question sentences are repeatedly answered can be avoided, the retrieval efficiency of the question answers is improved, and further, the embodiment of the application can ensure the accuracy of the question answers returned to the user by checking the timeliness of the question answers. Therefore, the answer retrieval method, the device, the electronic equipment and the storage medium based on the artificial intelligence can improve the recognition capability of the problem semantics and realize the enhancement of the retrieval efficiency of the problem answers.
Drawings
FIG. 1 is a flowchart of an answer retrieval method based on artificial intelligence according to an embodiment of the application;
FIG. 2 is a schematic block diagram of an answer retrieval device based on artificial intelligence according to an embodiment of the application;
FIG. 3 is a schematic diagram of an internal structure of an electronic device for implementing an answer retrieval method based on artificial intelligence according to an embodiment of the present application;
the achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The embodiment of the application provides an answer retrieval method based on artificial intelligence. The execution subject of the answer retrieval method based on artificial intelligence includes, but is not limited to, at least one of a server, a terminal and the like capable of being configured to execute the method provided by the embodiment of the application. In other words, the answer retrieval method based on artificial intelligence may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (ContentDelivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 1, a flowchart of an answer retrieval method based on artificial intelligence according to an embodiment of the application is shown. In the embodiment of the application, the answer retrieval method based on artificial intelligence comprises the following steps:
s1, receiving a problem statement input by a user on a search platform, generating a similar statement vector of the problem statement by using a vector generation mechanism in a trained semantic recognition model, and extracting the semantic vector of the problem statement from the similar statement vector by using a semantic recognition mechanism in the trained semantic recognition model.
In the embodiment of the application, the search platform can be understood as a search engine providing a problem consultation for a user, such as a hundred-degree search platform, the problem statement is sent out by different users, such as the problem statement of the user A is a "debit card handling process", the problem statement of the user B is a "debit card application condition", and the like, the semantic recognition model is constructed through a pre-training language model (UNILM) and is used for recognizing the semantic representation of the problem statement, namely, the semantic of the problem statement is represented through a vector form, and the problem semantic of the problem statement is recognized in a deeper layer.
Further, in the embodiment of the present application, the semantic recognition model includes a vector generation mechanism and a semantic recognition mechanism, where the vector generation mechanism is used to label an information sequence of the problem statement so as to generate a similar statement vector of the problem statement, and the semantic recognition mechanism is used to recognize a statement vector that can characterize the problem statement in the similar statement vector.
Further, before the generating of the similar sentence vector of the problem sentence by using the vector generating mechanism in the trained semantic recognition model, the embodiment of the present application further includes: obtaining a training corpus, wherein the training corpus comprises training sentences and corresponding real similar sentences, inputting the training corpus into a vector generation mechanism in a pre-built semantic recognition model to output a predicted similar sentence vector of the training corpus, calculating a first similarity loss of the predicted similar sentence vector and the corresponding real similar sentences by using a loss function in the vector generation mechanism, calculating a second similarity loss of the predicted similar sentence vector and the corresponding training sentences by using the semantic recognition mechanism in the pre-built semantic recognition model, calculating a final similarity loss of the pre-built semantic recognition model according to the first similarity loss and the second similarity loss, readjusting parameters of the pre-built semantic recognition model if the final similarity loss is larger than the preset similarity loss, and returning to the step of executing the vector generation mechanism for inputting the training corpus into the pre-built semantic recognition model if the final similarity loss is not larger than the preset similarity loss, so as to obtain the trained semantic recognition model.
Further, in an optional embodiment of the present application, the inputting the training corpus into a vector generation mechanism in a pre-constructed semantic recognition model to output a predicted similar sentence vector of the training corpus includes: and carrying out position vector coding on the training corpus by using an encoder in the vector generation mechanism to obtain coded vector corpus, masking the coded vector corpus by using a masking layer in the vector generation mechanism to obtain masked vector corpus, and carrying out sequence decoding on the masked vector corpus by using a decoder in the vector generation mechanism to obtain a prediction similarity statement vector of the training corpus.
For example, there are training corpus including a sentence a and a sentence b, where the sentence a is an input sentence, the sentence b is a similar sentence of the sentence a, and as a true similar sentence of the sentence a, there are data t1 and t2 in the sentence a, and there are data t3, t4, and t5 in the sentence b, then it is obtained by performing position vector encoding on the training sentence by the encoder: the coded vector corpus of [ cls ] t1 t2[ sep ] t3 t4 t5[ sep ] can be obtained by masking t2 and t4 in the coded vector corpus by the masking layer, and the masked vector corpus is [ cls ] t1 masked [ sep ] t3 masked t5[ sep ], and can be understood as: t1 t2 can access the four mask sequences of "[ cls ] t1 t2[ sep ]", t4 can access the six mask sequences of [ cls ] t1 t2[ sep ] t3 t4, and further, the mask sequences in the mask vector corpus are decoded by using an attention mechanism in the decoder so as to obtain a prediction similar sentence vector of the sentence a.
Further, in an alternative embodiment of the present application, the loss function in the vector generation mechanism includes:
where loss1 represents a first similarity loss, k represents the number of training corpora, y i Representing a predicted similarity statement vector, y i A vector representing a true similarity statement.
Further, in an optional embodiment of the present application, the calculating, by using a semantic recognition mechanism in the pre-constructed semantic recognition model, a second similarity loss between the prediction similarity statement vector and a training statement corresponding to the prediction similarity statement vector includes: constructing a sentence vector matrix of the prediction similarity sentence vector, normalizing the sentence vector matrix to obtain a normalized vector matrix, carrying out inner product on the normalized vector matrix to obtain a similarity vector matrix, carrying out dimension expansion on the similarity vector matrix to obtain a high-dimensional similarity vector matrix, and calculating second similarity loss of the high-dimensional similarity vector matrix and a training sentence corresponding to the high-dimensional similarity vector matrix by using a loss function in the semantic recognition mechanism.
The sentence vector matrix can be constructed by taking the number b of samples of the prediction similar sentence vector and the dimension d as row and column labels of the matrix, the normalization is to reduce the dimension of the sentence vector matrix and reduce the subsequent data calculation amount, the inner product of the normalized vector matrix is to multiply the sentence vector matrix two by two for guaranteeing the accuracy of the subsequent second similar loss calculation, and the dimension expansion is to facilitate the visualization of the subsequent second similar loss calculation, which can be set to 50 or set according to the actual service scene.
Further, in yet another alternative embodiment of the present application, the loss function in the semantic recognition mechanism includes:
where loss2 represents a second similarity loss, b represents the number of samples of the predicted similarity statement vector, y (x i ) A vector representing the training statement is presented,representing a high-dimensional similarity vector matrix.
Further, in an alternative embodiment of the present application, the final similarity loss of the pre-constructed semantic recognition model is calculated using the following formula:
loss=αloss1+βloss2
where loss represents the final similarity loss, loss1 represents the first similarity loss, loss2 represents the second similarity loss, α and β are adjustable super-parameters, and the value range is [0,1].
Further, in an optional embodiment of the present application, the preset similarity loss may be set to 0.1, or may be set according to an actual service scenario, and the parameters of the pre-constructed semantic recognition model may be implemented by an optimizer, such as an AdamW optimizer.
Further, the embodiment of the present application inputs the problem sentence into the trained semantic recognition model to output the semantic vector of the problem sentence, where the principle of generating the semantic vector may refer to the training process of the semantic recognition model, and is not further described herein.
Based on the trained semantic recognition model, a vector semantic representation form of the problem statement can be obtained, the literal semantic representation of the problem statement is avoided, the deeper semantic representation of the problem statement is realized, and further the questions with the same semantic and without the same text content can be rapidly recognized and matched.
S2, matching the problem vector of the semantic vector from a pre-constructed vector database.
In the embodiment of the present application, the vector database may be constructed by a Milvus database, and it should be noted that, in the embodiment of the present application, the problem vector in the vector database may be obtained by performing semantic encoding on the history consulting problem by using the trained semantic recognition model.
As one embodiment of the present application, the problem vector matching the semantic vector from the pre-constructed vector database includes: and calculating the similarity between the semantic vector and the vector in the pre-constructed vector database, and taking the vector with the similarity larger than the preset similarity as the problem vector of the semantic vector. Optionally, the preset similarity may be set to 0.9, or may be set according to an actual service scenario.
In an alternative embodiment, the similarity of the semantic vector to the vectors in the vector database is calculated using the following formula:
where cos (θ) represents similarity, a represents a semantic vector, and b represents a vector in the vector database.
S3, searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking timeliness of the question answer.
In the embodiment of the application, the question-answer knowledge base can be constructed by a historical question-answer base and a knowledge base, wherein the historical question-answer base refers to a database for replying answers to questions of historical consultation, and the knowledge base refers to a business database containing the questions and the answers.
As one embodiment of the present application, the searching the question answers of the question vector from the pre-constructed question-answer knowledge base includes: and matching the question fields in the pre-constructed question-answer knowledge base according to the vector fields of the question vectors, and taking the answers corresponding to the successfully matched question fields as the question answers of the question vectors.
Further, it should be appreciated that in an actual business scenario, since the answers of a plurality of questions have a certain timeliness, such as purchasing a house lpr will change with time, the embodiment of the present application ensures the accuracy of the answers returned to the user by checking the timeliness of the answers of the questions.
Further, to ensure the security and privacy of the answers to the questions, the answers to the questions may also be stored in a blockchain node.
And S4, returning the answer to the question to the user when the timeliness meets a preset condition.
In the embodiment of the application, when the timeliness meets the preset condition, the searched answer is indicated to have accuracy, so that the embodiment of the application directly returns the question answer to the user to realize the question answer retrieval of the user, wherein the preset condition can be set as to whether the timeliness is in the latest state or not, and can also be set according to an actual service scene.
And S5, when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user.
In the embodiment of the application, when the timeliness does not meet the preset condition, the searched answer is not accurate, so that the embodiment of the application returns the answer to the user after updating the answer of the question vector, namely, the question corresponding to the question vector is transmitted to a professional for answer and then returned to the user, so that the answer accuracy of the question vector is ensured.
It can be seen that, according to the embodiment of the application, the semantic feature extraction is performed on the question sentences input by the user through the trained semantic recognition model, so that the question sentences have a vector semantic representation form, the literal semantic representation of the question sentences is avoided, the deeper semantic representation of the question sentences is realized, further, the questions with the same semantics and without the same text content can be rapidly recognized and matched, and the question vectors of the semantic vectors are matched from the vector database, so that the search of the question answers of the question vectors in the question and answer knowledge base is realized, the phenomenon that the question sentences are repeatedly answered can be avoided, the retrieval efficiency of the question answers is improved, and further, the embodiment of the application can ensure the accuracy of the question answers returned to the user by checking the timeliness of the question answers. Therefore, the answer retrieval method based on artificial intelligence can improve the recognition capability of the problem semantics and realize the enhancement of the retrieval efficiency of the problem answers.
As shown in FIG. 2, a functional block diagram of the answer retrieval device based on artificial intelligence according to the application is shown.
The answer retrieval device 100 based on artificial intelligence according to the present application may be installed in an electronic device. Depending on the implemented functions, the answer retrieval device based on artificial intelligence may include a semantic vector recognition module 101, a question vector matching module 102, a question answer search module 103, and a question answer return module 104. The module according to the application, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the semantic vector recognition module 101 is configured to receive a problem sentence input by a user on a search platform, generate a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extract a semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model;
the problem vector matching module 102 is configured to match a problem vector of the semantic vector from a pre-constructed vector database;
the question answer searching module 103 is configured to search a question answer of the question vector from a pre-constructed question-answer knowledge base, and verify the timeliness of the question answer;
the answer to question return module 104 is configured to return the answer to question to the user when the timeliness meets a preset condition;
the answer to question returning module 105 is further configured to update the answer of the question vector and return the answer to the user when the timeliness does not meet the preset condition.
In detail, the modules in the answer search device 100 based on artificial intelligence in the embodiment of the present application use the same technical means as the answer search method based on artificial intelligence described in fig. 1, and can produce the same technical effects, which are not described herein.
As shown in fig. 3, a schematic structural diagram of an electronic device 1 implementing an answer retrieval method based on artificial intelligence according to the present application is shown.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program stored in the memory 11 and executable on the processor 10, such as an answer retrieval program based on artificial intelligence.
The processor 10 may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing unit, CPU), a microprocessor, a digital processing chip, a graphics processor, a combination of various control chips, and so on. The processor 10 is a Control Unit (Control Unit) of the electronic device 1, connects the respective components of the entire electronic device 1 using various interfaces and lines, executes various functions of the electronic device 1 and processes data by running or executing programs or modules stored in the memory 11 (for example, executing an answer retrieval program based on artificial intelligence, etc.), and calls data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of answer search programs based on artificial intelligence, but also for temporarily storing data that has been output or is to be output.
The communication bus 12 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
The communication interface 13 is used for communication between the electronic device 1 and other devices, including a network interface and a user interface. Optionally, the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device 1 and other electronic devices 1. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
Fig. 3 shows only an electronic device 1 with components, it being understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The answer retrieval program based on artificial intelligence stored in the memory 11 in the electronic device 1 is a combination of a plurality of computer programs, which when run in the processor 10, can realize:
receiving a problem sentence input by a user on a search platform, generating a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extracting a semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model;
matching the problem vector of the semantic vector from a pre-constructed vector database;
searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking the timeliness of the question answer;
when the timeliness meets a preset condition, returning the answer to the question to the user;
and when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user.
In particular, the specific implementation method of the processor 10 on the computer program may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the integrated modules/units of the electronic device 1 may be stored in a non-volatile computer readable storage medium if implemented in the form of software functional units and sold or used as a stand alone product. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present application also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device 1, may implement:
receiving a problem sentence input by a user on a search platform, generating a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extracting a semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model;
matching the problem vector of the semantic vector from a pre-constructed vector database;
searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking the timeliness of the question answer;
when the timeliness meets a preset condition, returning the answer to the question to the user;
and when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user. In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present application and not for limiting the same, and although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present application without departing from the spirit and scope of the technical solution of the present application.

Claims (7)

1. An answer retrieval method based on artificial intelligence, the method comprising:
receiving a problem sentence input by a user on a search platform, generating a similar sentence vector of the problem sentence by using a vector generation mechanism in a trained semantic recognition model, and extracting a semantic vector of the problem sentence from the similar sentence vector by using a semantic recognition mechanism in the trained semantic recognition model;
matching the problem vector of the semantic vector from a pre-constructed vector database;
searching a question answer of the question vector from a pre-constructed question-answer knowledge base, and checking the timeliness of the question answer;
when the timeliness meets a preset condition, returning the answer to the question to the user;
when the timeliness does not meet the preset condition, updating the answer of the question vector and returning to the user;
before the similar sentence vector of the problem sentence is generated by using the vector generation mechanism in the trained semantic recognition model, the method further comprises: acquiring a training corpus, wherein the training corpus comprises training sentences and corresponding real similar sentences; inputting the training corpus into a vector generation mechanism in a pre-constructed semantic recognition model to output a prediction similar sentence vector of the training corpus, and calculating a first similarity loss of the prediction similar sentence vector and a corresponding real similar sentence by using a loss function in the vector generation mechanism; calculating second similar loss of the prediction similar sentence vector and the corresponding training sentence by utilizing a semantic recognition mechanism in the pre-constructed semantic recognition model; calculating the final similarity loss of the pre-constructed semantic recognition model according to the first similarity loss and the second similarity loss; if the final similarity loss is larger than the preset similarity loss, readjusting parameters of the pre-constructed semantic recognition model, and returning to the step of executing the vector generation mechanism for inputting the training corpus into the pre-constructed semantic recognition model; if the final similarity loss is not greater than the preset similarity loss, obtaining a trained semantic recognition model;
the calculating, by using a semantic recognition mechanism in the pre-constructed semantic recognition model, a second similarity loss between the prediction similarity statement vector and the training statement corresponding to the prediction similarity statement vector, including: constructing a sentence vector matrix of the prediction similarity sentence vector, and normalizing the sentence vector matrix to obtain a normalized vector matrix; performing inner product on the normalized vector matrix to obtain a similarity vector matrix, and performing dimension expansion on the similarity vector matrix to obtain a high-dimensional similarity vector matrix; calculating second similar losses of the high-dimensional similarity vector matrix and the corresponding training sentences by using a loss function in the semantic recognition mechanism;
the calculation formula of the first similarity loss is as follows:
where loss1 represents a first similarity loss, k represents the number of training corpora, y i Representing the predicted similarity statement vector, y' i A vector representing a true similarity statement;
the calculation formula of the second similar loss is as follows:
where loss2 represents a second similarity loss, b represents the number of samples of the predicted similarity statement vector, y (x i ) A vector representing the training statement is presented,representing a high-dimensional similarity vector matrix;
the calculation formula of the final similarity loss is as follows:
loss=αloss1+βloss2
where loss represents the final similarity loss, alpha and beta are adjustable super parameters, and the value range is [0,1].
2. The answer retrieval method based on artificial intelligence according to claim 1, wherein said inputting the training corpus into a vector generation mechanism in a pre-constructed semantic recognition model to output a predicted similar sentence vector of the training corpus comprises:
performing position vector coding on the training corpus by using an encoder in the vector generation mechanism to obtain a coded vector corpus;
masking the coded vector corpus by using a masking layer in the vector generation mechanism to obtain a masking vector corpus;
and performing sequence decoding on the mask vector corpus by using a decoder in the vector generation mechanism to obtain a prediction similarity statement vector of the training corpus.
3. The answer retrieval method based on artificial intelligence according to claim 1, wherein said matching of said semantic vector from a pre-constructed vector database to a question vector comprises:
and calculating the similarity between the semantic vector and the vector in the pre-constructed vector database, and taking the vector with the similarity larger than the preset similarity as the problem vector of the semantic vector.
4. An artificial intelligence based answer retrieval method according to any one of claims 1 to 3, in which said searching for answers to questions of said question vector from a pre-constructed knowledge base of questions comprises:
and matching the question fields in the pre-constructed question-answer knowledge base according to the vector fields of the question vectors, and taking the answers corresponding to the successfully matched question fields as the question answers of the question vectors.
5. An artificial intelligence based answer retrieval apparatus for implementing an artificial intelligence based answer retrieval method according to any one of claims 1 to 4, said apparatus comprising:
the semantic vector recognition module is used for receiving a problem statement input by a user on a search platform, generating a similar statement vector of the problem statement by using a vector generation mechanism in a trained semantic recognition model, and extracting the semantic vector of the problem statement from the similar statement vector by using a semantic recognition mechanism in the trained semantic recognition model;
the problem vector matching module is used for matching the problem vector of the semantic vector from a pre-constructed vector database;
the question answer searching module is used for searching the question answers of the question vectors from a pre-constructed question answer knowledge base and verifying the timeliness of the question answers;
the question answer returning module is used for returning the question answer to the user when the timeliness meets a preset condition;
and the question answer returning module is further configured to update the answer of the question vector and return the answer to the user when the timeliness does not meet the preset condition.
6. An electronic device, the electronic device comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the artificial intelligence based answer retrieval method of any one of claims 1 to 4.
7. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the artificial intelligence based answer retrieval method according to any one of claims 1 to 4.
CN202111149209.0A 2021-09-29 2021-09-29 Answer retrieval method and device based on artificial intelligence, electronic equipment and medium Active CN113821622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111149209.0A CN113821622B (en) 2021-09-29 2021-09-29 Answer retrieval method and device based on artificial intelligence, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111149209.0A CN113821622B (en) 2021-09-29 2021-09-29 Answer retrieval method and device based on artificial intelligence, electronic equipment and medium

Publications (2)

Publication Number Publication Date
CN113821622A CN113821622A (en) 2021-12-21
CN113821622B true CN113821622B (en) 2023-09-15

Family

ID=78915907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111149209.0A Active CN113821622B (en) 2021-09-29 2021-09-29 Answer retrieval method and device based on artificial intelligence, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113821622B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114491024B (en) * 2021-12-31 2024-04-26 长城信息股份有限公司 Specific field multi-label text classification method based on small sample
CN114637765A (en) * 2022-04-26 2022-06-17 阿里巴巴达摩院(杭州)科技有限公司 Man-machine interaction method, device and equipment based on form data
CN116628171B (en) * 2023-07-24 2023-10-20 北京惠每云科技有限公司 Medical record retrieval method and system based on pre-training language model

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046147A (en) * 2018-10-11 2020-04-21 马上消费金融股份有限公司 Question answering method and device and terminal equipment
CN111860588A (en) * 2020-06-12 2020-10-30 华为技术有限公司 Training method for graph neural network and related equipment
CN113204633A (en) * 2021-06-01 2021-08-03 吉林大学 Semantic matching distillation method and device
CN113268564A (en) * 2021-05-24 2021-08-17 平安科技(深圳)有限公司 Method, device and equipment for generating similar problems and storage medium
WO2021159877A1 (en) * 2020-02-14 2021-08-19 华为技术有限公司 Question answering method and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180068023A1 (en) * 2016-09-07 2018-03-08 Facebook, Inc. Similarity Search Using Polysemous Codes

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111046147A (en) * 2018-10-11 2020-04-21 马上消费金融股份有限公司 Question answering method and device and terminal equipment
WO2021159877A1 (en) * 2020-02-14 2021-08-19 华为技术有限公司 Question answering method and apparatus
CN111860588A (en) * 2020-06-12 2020-10-30 华为技术有限公司 Training method for graph neural network and related equipment
CN113268564A (en) * 2021-05-24 2021-08-17 平安科技(深圳)有限公司 Method, device and equipment for generating similar problems and storage medium
CN113204633A (en) * 2021-06-01 2021-08-03 吉林大学 Semantic matching distillation method and device

Also Published As

Publication number Publication date
CN113821622A (en) 2021-12-21

Similar Documents

Publication Publication Date Title
CN113821622B (en) Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
CN113157927B (en) Text classification method, apparatus, electronic device and readable storage medium
CN112988963B (en) User intention prediction method, device, equipment and medium based on multi-flow nodes
CN111767375A (en) Semantic recall method and device, computer equipment and storage medium
CN113378970B (en) Sentence similarity detection method and device, electronic equipment and storage medium
CN113887941B (en) Business process generation method, device, electronic equipment and medium
CN115238670B (en) Information text extraction method, device, equipment and storage medium
CN113627797A (en) Image generation method and device for employee enrollment, computer equipment and storage medium
CN116821373A (en) Map-based prompt recommendation method, device, equipment and medium
CN114840684A (en) Map construction method, device and equipment based on medical entity and storage medium
CN113360654B (en) Text classification method, apparatus, electronic device and readable storage medium
CN114461777A (en) Intelligent question and answer method, device, equipment and storage medium
CN114416939A (en) Intelligent question and answer method, device, equipment and storage medium
CN112632264A (en) Intelligent question and answer method and device, electronic equipment and storage medium
CN116628162A (en) Semantic question-answering method, device, equipment and storage medium
CN116341646A (en) Pretraining method and device of Bert model, electronic equipment and storage medium
CN116468025A (en) Electronic medical record structuring method and device, electronic equipment and storage medium
CN115346095A (en) Visual question answering method, device, equipment and storage medium
CN114610854A (en) Intelligent question and answer method, device, equipment and storage medium
CN114676307A (en) Ranking model training method, device, equipment and medium based on user retrieval
CN113723114A (en) Semantic analysis method, device and equipment based on multi-intent recognition and storage medium
CN114462411B (en) Named entity recognition method, device, equipment and storage medium
CN115221875B (en) Word weight generation method, device, electronic equipment and storage medium
CN117271755B (en) Custom closed-loop rule engine management control method based on artificial intelligence
CN117874202A (en) Intelligent question-answering method and system based on large model

Legal Events

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