CN116628162A - Semantic question-answering method, device, equipment and storage medium - Google Patents

Semantic question-answering method, device, equipment and storage medium Download PDF

Info

Publication number
CN116628162A
CN116628162A CN202310603965.9A CN202310603965A CN116628162A CN 116628162 A CN116628162 A CN 116628162A CN 202310603965 A CN202310603965 A CN 202310603965A CN 116628162 A CN116628162 A CN 116628162A
Authority
CN
China
Prior art keywords
semantic
question
query
model
recall
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310603965.9A
Other languages
Chinese (zh)
Inventor
袁冶
赵晓辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202310603965.9A priority Critical patent/CN116628162A/en
Publication of CN116628162A publication Critical patent/CN116628162A/en
Pending legal-status Critical Current

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
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • 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
    • 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
    • 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 Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to artificial intelligence technology in the field of financial science and technology, and discloses a semantic question-answering method, which comprises the following steps: acquiring a semantic question-answer pair set, training a pre-built parallel semantic model by utilizing the semantic question-answer pair set to obtain a semantic question-answer model, acquiring a user query question, segmenting the user query question to obtain a query segmentation result, carrying out semantic recall on the user query question and a question in a pre-built question bank by utilizing the semantic question-answer model based on the query segmentation result to obtain a semantic recall result, carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result. The invention also relates to a blockchain technique, and the semantic query answers can be stored in nodes of the blockchain. The invention also provides a semantic question-answering device, electronic equipment and a readable storage medium. The invention can improve the accuracy of semantic question and answer.

Description

Semantic question-answering method, device, equipment and storage medium
Technical Field
The invention relates to the technical fields of financial science and technology and artificial intelligence, in particular to a semantic question-answering method, a semantic question-answering device, electronic equipment and a readable storage medium.
Background
With the development of artificial intelligence, it is increasingly important to conduct intelligent information searching through a search engine, wherein the search engine is a system for searching, sorting and classifying internet information resources and storing the internet information resources in a network database for users to inquire, and the system comprises three parts of information collection, information classification and user inquiry, and the search engine plays a role in guiding in application scenes on one hand, and on the other hand, can help users to know the depth of a database, namely, the users can learn and know the quantity and quality level of knowledge through the website or the application.
In the prior art, a search engine based on a Elasticsearch (ES) framework is one of the main forces of the current-stage search engine, and is known for having high speed and searching word level, but the word segmentation and calculation of search terms and sentences are limited in the interactivity of semantic understanding of the search terms and sentences with the user, so that semantic question-answering is inaccurate. For example: in the financial field, if a user searches 'buy insurance' only 'how to buy insurance' in a library, the user can hardly search out the result because three words of 'buy', 'insurance' are scored around when the 'buy insurance' ES calculates the score. Since 'how to buy an insurance' only contains 'buy', 'insurance', it is not ranked in front as a high score, but instead enables many search results containing 'buy', 'insurance'. In view of the foregoing, there is a need for a method that can accurately understand the input semantics of a user to accurately perform a semantic question-answering.
Disclosure of Invention
The invention provides a semantic question-answering method, a semantic question-answering device, electronic equipment and a readable storage medium, and mainly aims to improve the accuracy of semantic question-answering.
In order to achieve the above object, the present invention provides a semantic question-answering method, including:
acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model;
acquiring a user query problem, and segmenting the user query problem to obtain a query segmentation result;
based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result;
and carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
Optionally, training the pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model, including:
extracting features of the user history problems in the semantic question-answer pair set by using a first parallel network in the parallel semantic model to obtain a first semantic feature vector;
extracting features of the service standard problems in the semantic question-answer pair set by using a second parallel network in the parallel semantic model to obtain a second semantic feature vector;
performing feature stitching on the first semantic feature vector and the second semantic feature vector by using a feature stitching layer in the parallel semantic model to obtain stitched feature vectors,
and obtaining a classification result by using a feature classification layer in a feature splicing layer in the parallel semantic model, calculating a loss value of the classification result by using a preset loss function, adjusting model parameters in the parallel semantic model when the loss value does not meet a preset loss threshold, and returning to the step of extracting features of the user history problems in the set by using a first parallel network in the parallel semantic model until the loss value meets the preset loss threshold, and connecting the first parallel network and the second parallel network in parallel to obtain the semantic question-answer model.
Optionally, the word segmentation is performed on the user query question to obtain a query word segmentation result, including:
and performing word segmentation processing on the user query problem by using a preset word segmentation method to obtain a query word segmentation result.
Optionally, based on the query word segmentation result, the semantic recall of the user query questions and the questions in the pre-constructed question bank by using the semantic question-answer model includes:
judging whether the word segmentation quantity in the query word segmentation result meets a preset quantity threshold value or not;
if the word segmentation number in the query word segmentation result does not meet a preset number threshold, carrying out error prompt on a preset terminal;
and if the word segmentation quantity in the query word segmentation result meets a preset quantity threshold, carrying out semantic recall on the user query problem and the problems in the pre-constructed problem library by utilizing the semantic question-answering model.
Optionally, the semantic recall of the user query questions and questions in the pre-constructed question bank by using the semantic question-answer model includes:
extracting features of the user query questions by using a first parallel network in the semantic question-answering model to obtain a first query vector;
traversing the problems in the problem library, and extracting features of the traversed problems by using a first parallel network in the semantic question-answering model to obtain a second query vector;
calculating the semantic similarity of the first query vector and the second query vector, and recalling the problem that the semantic similarity in the question bank meets a preset similarity threshold.
Optionally, the semantic similarity is calculated using the following formula:
where cos (, B) represents the semantic similarity of the first query vector a and the second query vector B.
Optionally, the performing relevance grading on the semantic recall result, and obtaining the semantic query answer corresponding to the user query question according to the relevance grading result includes:
performing relevance descending arrangement on recall problems in the semantic recall result according to semantic similarity to obtain a recall title sequence;
and classifying the recall title sequence in a grading manner by using a preset grading threshold value to obtain a grading title sequence, and taking a question answer corresponding to the grading title sequence in a question library as a semantic query answer corresponding to the user query question.
In order to solve the above problems, the present invention further provides a semantic question-answering device, which includes:
the model training module is used for acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by utilizing the semantic question-answer pair set to obtain a semantic question-answer model;
the semantic recall module is used for acquiring a user query problem, segmenting the user query problem to obtain a query segmentation result, and carrying out semantic recall on the user query problem and the problem in the pre-constructed problem library by utilizing the semantic question-answer model based on the query segmentation result to obtain a semantic recall result;
and the grading query module is used for carrying out relevance grading on the semantic recall result and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
a memory storing at least one computer program; and
And the processor executes the computer program stored in the memory to realize the semantic question-answering method.
In order to solve the above-mentioned problems, the present invention 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 semantic question-answering method.
According to the invention, a semantic question-answering model is obtained by training a pre-constructed parallel semantic model, a user query question is segmented to obtain a query segmentation result, based on the query segmentation result, the semantic question-answering model is utilized to carry out semantic recall on the user query question and the questions in a pre-constructed question bank, the user semantics can be fully understood from segmentation, a semantic recall result is obtained, and finally, the semantic query answer corresponding to the user query question is obtained by carrying out relevance grading on the semantic recall result. Therefore, the semantic question-answering method, the semantic question-answering device, the electronic equipment and the computer readable storage medium can improve the accuracy of the semantic question-answering.
Drawings
FIG. 1 is a flow chart of a semantic question-answering method according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a semantic question-answering device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device for implementing the semantic question-answering method according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention 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 invention.
The embodiment of the invention provides a semantic question-answering method. The execution subject of the semantic question-answering method includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the invention. In other words, the semantic question-answering method 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 flow chart of a semantic question-answering method according to an embodiment of the present invention is shown.
In this embodiment, the semantic question answering method includes the following steps S1-S4:
s1, acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model.
In the embodiment of the invention, the semantic question-answer pair set can be a set of different domain standard question-answer texts and historical question texts input by users, such as question-answer libraries of agent communities in financial domains, insurance, funds and the like. The pre-built parallel semantic model may be a pre-trained SBERT (Sentence-BERT) model that includes two parallel networks (bert+pooling layers), a feature stitching layer and a feature classification layer (Softmax).
In detail, training the pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model, which comprises the following steps:
extracting features of the user history problems in the semantic question-answer pair set by using a first parallel network in the parallel semantic model to obtain a first semantic feature vector;
extracting features of the service standard problems in the semantic question-answer pair set by using a second parallel network in the parallel semantic model to obtain a second semantic feature vector;
performing feature stitching on the first semantic feature vector and the second semantic feature vector by using a feature stitching layer in the parallel semantic model to obtain stitched feature vectors,
and obtaining a classification result by using a feature classification layer in a feature splicing layer in the parallel semantic model, calculating a loss value of the classification result by using a preset loss function, adjusting model parameters in the parallel semantic model when the loss value does not meet a preset loss threshold, and returning to the step of extracting features of the user history problems in the set by using a first parallel network in the parallel semantic model until the loss value meets the preset loss threshold, and connecting the first parallel network and the second parallel network in parallel to obtain the semantic question-answer model.
In an alternative embodiment of the present invention, for example, in the financial field, a user history problem is input as a sentence a into a first parallel network, and a service standard problem is input as a sentence B into a second parallel network, so as to obtain a first semantic feature vector a and a second semantic feature vector B, respectively, absolute values of the two vectors are taken as |a-b|, then the three vectors are spliced to obtain spliced feature vectors (a, B, |a-b|), and finally classification is performed through Softmax, so as to obtain a classification result.
In an optional embodiment of the invention, the predetermined loss function is a cross entropy loss function.
S2, acquiring a user query problem, and segmenting the user query problem to obtain a query segmentation result.
In the embodiment of the invention, for example, in the financial field, the user inquiry problem can be 'buy insurance at a glance'.
In detail, the word segmentation is performed on the user query problem to obtain a query word segmentation result, which includes:
and performing word segmentation processing on the user query problem by using a preset word segmentation method to obtain a query word segmentation result.
In an alternative embodiment of the present invention, the word segmentation may be performed by using methods such as jieba word segmentation, to obtain a word segmentation result.
S3, based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result.
In detail, the performing semantic recall on the user query questions and the questions in the pre-constructed question library by using the semantic question-answering model based on the query word segmentation result includes:
judging whether the word segmentation quantity in the query word segmentation result meets a preset quantity threshold value or not;
if the word segmentation number in the query word segmentation result does not meet a preset number threshold, carrying out error prompt on a preset terminal;
and if the word segmentation quantity in the query word segmentation result meets a preset quantity threshold, carrying out semantic recall on the user query problem and the problems in the pre-constructed problem library by utilizing the semantic question-answering model.
In an alternative embodiment of the present invention, because the number of the segmented words is too small, the accuracy of semantic understanding of the model is low, and thus, if the number of the segmented words is less than a preset threshold value, the user is reminded of re-inputting the problem. For example, 3 or more word segmentation results may be subject to subsequent semantic recall operations.
In detail, the semantic recall of the user query questions and questions in a pre-constructed question bank by using the semantic question-answer model comprises:
extracting features of the user query questions by using a first parallel network in the semantic question-answering model to obtain a first query vector;
traversing the problems in the problem library, and extracting features of the traversed problems by using a first parallel network in the semantic question-answering model to obtain a second query vector;
calculating the semantic similarity of the first query vector and the second query vector, and recalling the problem that the semantic similarity in the question bank meets a preset similarity threshold.
In the embodiment of the invention, for example, in the financial field, the title of the community problem library of the insurance agent is subjected to the ebedding through an ebelt-384-dimension ebedding model, and the most similar top 50 titles are searched for and recalled through the ebedding of the problem queried by the user.
In an alternative embodiment of the present invention, the semantic similarity is calculated using the following formula:
where cos (, B) represents the semantic similarity of the first query vector a and the second query vector B.
And S4, carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
In detail, the performing relevance grading on the semantic recall result, and obtaining the semantic query answer corresponding to the user query question according to the relevance grading result includes:
performing relevance descending arrangement on recall problems in the semantic recall result according to semantic similarity to obtain a recall title sequence;
and classifying the recall title sequence in a grading manner by using a preset grading threshold value to obtain a grading title sequence, and taking a question answer corresponding to the grading title sequence in a question library as a semantic query answer corresponding to the user query question.
In an alternative embodiment of the present invention, for example, in the financial arts, the grading can be categorized into full correlation, high correlation, medium correlation and low correlation. According to community problems of insurance agents, the complete correlation is a title with a correlation degree of more than 0.998 with the user query problem, the high correlation is a title with a correlation degree of 0.9775-0.998 with the user query problem, the medium correlation is a title with a correlation degree of 0.9-0.9775 with the user query problem, and the low correlation is a title with a correlation degree of 0.85-0.9 with the user query problem. Through grading classification, the problem with the most similar semantics can be preferentially displayed to the user, and the accuracy and efficiency of the semantic question and answer are improved.
According to the invention, a semantic question-answering model is obtained by training a pre-constructed parallel semantic model, a user query question is segmented to obtain a query segmentation result, based on the query segmentation result, the semantic question-answering model is utilized to carry out semantic recall on the user query question and the questions in a pre-constructed question bank, the user semantics can be fully understood from segmentation, a semantic recall result is obtained, and finally, the semantic query answer corresponding to the user query question is obtained by carrying out relevance grading on the semantic recall result. Therefore, the semantic question-answering method provided by the invention can improve the accuracy of semantic question-answering.
Fig. 2 is a functional block diagram of a semantic question-answering device according to an embodiment of the present invention.
The semantic question answering apparatus 100 of the present invention may be installed in an electronic device. Depending on the functionality implemented, the semantic question answering apparatus 100 may include a model training module 101, a semantic recall module 102, and a rank query module 103. The module of the invention, 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 model training module 101 is configured to obtain a set of semantic question-answer pairs, and train a pre-constructed parallel semantic model by using the set of semantic question-answer pairs to obtain a semantic question-answer model;
the semantic recall module 102 is configured to obtain a user query question, segment the user query question to obtain a query word segmentation result, and perform semantic recall on the user query question and a question in a pre-constructed question bank by using the semantic question-answer model based on the query word segmentation result to obtain a semantic recall result;
the grading query module 103 is configured to perform relevance grading on the semantic recall result, and obtain a semantic query answer corresponding to the user query question according to the relevance grading result.
In detail, the specific implementation manner of each module of the semantic question answering device 100 is as follows:
step one, acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model.
In the embodiment of the invention, the semantic question-answer pair set can be a set of different domain standard question-answer texts and historical question texts input by users, such as question-answer libraries of agent communities in financial domains, insurance, funds and the like. The pre-built parallel semantic model may be a pre-trained SBERT (Sentence-BERT) model that includes two parallel networks (bert+pooling layers), a feature stitching layer and a feature classification layer (Softmax).
In detail, training the pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model, which comprises the following steps:
extracting features of the user history problems in the semantic question-answer pair set by using a first parallel network in the parallel semantic model to obtain a first semantic feature vector;
extracting features of the service standard problems in the semantic question-answer pair set by using a second parallel network in the parallel semantic model to obtain a second semantic feature vector;
performing feature stitching on the first semantic feature vector and the second semantic feature vector by using a feature stitching layer in the parallel semantic model to obtain stitched feature vectors,
and obtaining a classification result by using a feature classification layer in a feature splicing layer in the parallel semantic model, calculating a loss value of the classification result by using a preset loss function, adjusting model parameters in the parallel semantic model when the loss value does not meet a preset loss threshold, and returning to the step of extracting features of the user history problems in the set by using a first parallel network in the parallel semantic model until the loss value meets the preset loss threshold, and connecting the first parallel network and the second parallel network in parallel to obtain the semantic question-answer model.
In an alternative embodiment of the present invention, for example, in the financial field, a user history problem is input as a sentence a into a first parallel network, and a service standard problem is input as a sentence B into a second parallel network, so as to obtain a first semantic feature vector a and a second semantic feature vector B, respectively, absolute values of the two vectors are taken as |a-b|, then the three vectors are spliced to obtain spliced feature vectors (a, B, |a-b|), and finally classification is performed through Softmax, so as to obtain a classification result.
In an optional embodiment of the invention, the predetermined loss function is a cross entropy loss function.
Step two, obtaining a user query problem, and segmenting the user query problem to obtain a query segmentation result.
In the embodiment of the invention, for example, in the financial field, the user inquiry problem can be 'buy insurance at a glance'.
In detail, the word segmentation is performed on the user query problem to obtain a query word segmentation result, which includes:
and performing word segmentation processing on the user query problem by using a preset word segmentation method to obtain a query word segmentation result.
In an alternative embodiment of the present invention, the word segmentation may be performed by using methods such as jieba word segmentation, to obtain a word segmentation result.
And thirdly, based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result.
In detail, the performing semantic recall on the user query questions and the questions in the pre-constructed question library by using the semantic question-answering model based on the query word segmentation result includes:
judging whether the word segmentation quantity in the query word segmentation result meets a preset quantity threshold value or not;
if the word segmentation number in the query word segmentation result does not meet a preset number threshold, carrying out error prompt on a preset terminal;
and if the word segmentation quantity in the query word segmentation result meets a preset quantity threshold, carrying out semantic recall on the user query problem and the problems in the pre-constructed problem library by utilizing the semantic question-answering model.
In an alternative embodiment of the present invention, because the number of the segmented words is too small, the accuracy of semantic understanding of the model is low, and thus, if the number of the segmented words is less than a preset threshold value, the user is reminded of re-inputting the problem. For example, 3 or more word segmentation results may be subject to subsequent semantic recall operations.
In detail, the semantic recall of the user query questions and questions in a pre-constructed question bank by using the semantic question-answer model comprises:
extracting features of the user query questions by using a first parallel network in the semantic question-answering model to obtain a first query vector;
traversing the problems in the problem library, and extracting features of the traversed problems by using a first parallel network in the semantic question-answering model to obtain a second query vector;
calculating the semantic similarity of the first query vector and the second query vector, and recalling the problem that the semantic similarity in the question bank meets a preset similarity threshold.
In the embodiment of the invention, for example, in the financial field, the title of the community problem library of the insurance agent is subjected to the ebedding through an ebelt-384-dimension ebedding model, and the most similar top 50 titles are searched for and recalled through the ebedding of the problem queried by the user.
In an alternative embodiment of the present invention, the semantic similarity is calculated using the following formula:
where cos (, B) represents the semantic similarity of the first query vector a and the second query vector B.
And fourthly, carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
In detail, the performing relevance grading on the semantic recall result, and obtaining the semantic query answer corresponding to the user query question according to the relevance grading result includes:
performing relevance descending arrangement on recall problems in the semantic recall result according to semantic similarity to obtain a recall title sequence;
and classifying the recall title sequence in a grading manner by using a preset grading threshold value to obtain a grading title sequence, and taking a question answer corresponding to the grading title sequence in a question library as a semantic query answer corresponding to the user query question.
In an alternative embodiment of the present invention, for example, in the financial arts, the grading can be categorized into full correlation, high correlation, medium correlation and low correlation. According to community problems of insurance agents, the complete correlation is a title with a correlation degree of more than 0.998 with the user query problem, the high correlation is a title with a correlation degree of 0.9775-0.998 with the user query problem, the medium correlation is a title with a correlation degree of 0.9-0.9775 with the user query problem, and the low correlation is a title with a correlation degree of 0.85-0.9 with the user query problem. Through grading classification, the problem with the most similar semantics can be preferentially displayed to the user, and the accuracy and efficiency of the semantic question and answer are improved.
According to the invention, a semantic question-answering model is obtained by training a pre-constructed parallel semantic model, a user query question is segmented to obtain a query segmentation result, based on the query segmentation result, the semantic question-answering model is utilized to carry out semantic recall on the user query question and the questions in a pre-constructed question bank, the user semantics can be fully understood from segmentation, a semantic recall result is obtained, and finally, the semantic query answer corresponding to the user query question is obtained by carrying out relevance grading on the semantic recall result. Therefore, the semantic question-answering device provided by the invention can improve the accuracy of semantic question-answering.
Fig. 3 is a schematic structural diagram of an electronic device for implementing the semantic question-answering method according to an embodiment of the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication interface 12 and a bus 13, and may further comprise a computer program, such as a semantic question-answering program, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card 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, such as a mobile hard disk of the electronic device. The memory 11 may in other embodiments also be an external storage device of the electronic device, 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. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various types of data, such as codes of a semantic question-and-answer program, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing Unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules (e.g., a semantic question-answering program, etc.) stored in the memory 11, and calling data stored in the memory 11.
The communication interface 12 is used for communication between the electronic device and other devices, including network interfaces and user interfaces. Optionally, the network interface may include 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 and other electronic devices. 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 and for displaying a visual user interface.
The bus 13 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 13 may be classified into an address bus, a data bus, a control bus, and the like. The bus 13 is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 is not limiting of the electronic device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, 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 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
Further, the electronic device may also include a network interface, optionally, the network interface may include 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 and other electronic devices.
Optionally, the electronic device may further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or 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 and for displaying a visual user interface.
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 semantic question-answering program stored by the memory 11 in the electronic device is a combination of instructions that, when executed in the processor 10, can implement:
acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model;
acquiring a user query problem, and segmenting the user query problem to obtain a query segmentation result;
based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result;
and carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
In particular, the specific implementation method of the above instructions by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of the drawings, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. 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 invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model;
acquiring a user query problem, and segmenting the user query problem to obtain a query segmentation result;
based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result;
and carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
In the several embodiments provided in the present invention, 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 invention 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 invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention 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 invention 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 embodiment of the invention 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.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
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.
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 invention and not for limiting the same, and although the present invention 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 invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

1. A semantic question-answering method, the method comprising:
acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by using the semantic question-answer pair set to obtain a semantic question-answer model;
acquiring a user query problem, and segmenting the user query problem to obtain a query segmentation result;
based on the query word segmentation result, carrying out semantic recall on the user query questions and the questions in the pre-constructed question library by utilizing the semantic question-answering model to obtain a semantic recall result;
and carrying out relevance grading on the semantic recall result, and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
2. The semantic question-answering method according to claim 1, wherein training the pre-constructed parallel semantic model by using the semantic question-answering pair set to obtain a semantic question-answering model comprises:
extracting features of the user history problems in the semantic question-answer pair set by using a first parallel network in the parallel semantic model to obtain a first semantic feature vector;
extracting features of the service standard problems in the semantic question-answer pair set by using a second parallel network in the parallel semantic model to obtain a second semantic feature vector;
performing feature stitching on the first semantic feature vector and the second semantic feature vector by using a feature stitching layer in the parallel semantic model to obtain stitched feature vectors,
and obtaining a classification result by using a feature classification layer in a feature splicing layer in the parallel semantic model, calculating a loss value of the classification result by using a preset loss function, adjusting model parameters in the parallel semantic model when the loss value does not meet a preset loss threshold, and returning to the step of extracting features of the user history problems in the set by using a first parallel network in the parallel semantic model until the loss value meets the preset loss threshold, and connecting the first parallel network and the second parallel network in parallel to obtain the semantic question-answer model.
3. The semantic question-answering method according to claim 1, wherein the word segmentation of the user query question to obtain a query word segmentation result comprises:
and performing word segmentation processing on the user query problem by using a preset word segmentation method to obtain a query word segmentation result.
4. The semantic question-answering method according to claim 1, wherein the semantic question-answering method for using the semantic question-answering model to recall the user query questions and questions in a pre-constructed question bank based on the query word segmentation result comprises:
judging whether the word segmentation quantity in the query word segmentation result meets a preset quantity threshold value or not;
if the word segmentation number in the query word segmentation result does not meet a preset number threshold, carrying out error prompt on a preset terminal;
and if the word segmentation quantity in the query word segmentation result meets a preset quantity threshold, carrying out semantic recall on the user query problem and the problems in the pre-constructed problem library by utilizing the semantic question-answering model.
5. The semantic question-answering method according to claim 3, wherein the using the semantic question-answering model to recall the user query questions and questions in a pre-constructed question bank comprises:
extracting features of the user query questions by using a first parallel network in the semantic question-answering model to obtain a first query vector;
traversing the problems in the problem library, and extracting features of the traversed problems by using a first parallel network in the semantic question-answering model to obtain a second query vector;
calculating the semantic similarity of the first query vector and the second query vector, and recalling the problem that the semantic similarity in the question bank meets a preset similarity threshold.
6. A semantic question-answering method according to claim 5, wherein the semantic similarity is calculated using the formula:
where cos (, B) represents the semantic similarity of the first query vector a and the second query vector B.
7. The semantic question-answering method according to claim 1, wherein the performing relevance ranking on the semantic recall result, and obtaining the semantic query answer corresponding to the user query question according to the relevance ranking result, comprises:
performing relevance descending arrangement on recall problems in the semantic recall result according to semantic similarity to obtain a recall title sequence;
and classifying the recall title sequence in a grading manner by using a preset grading threshold value to obtain a grading title sequence, and taking a question answer corresponding to the grading title sequence in a question library as a semantic query answer corresponding to the user query question.
8. A semantic question-answering apparatus, the apparatus comprising:
the model training module is used for acquiring a semantic question-answer pair set, and training a pre-constructed parallel semantic model by utilizing the semantic question-answer pair set to obtain a semantic question-answer model;
the semantic recall module is used for acquiring a user query problem, segmenting the user query problem to obtain a query segmentation result, and carrying out semantic recall on the user query problem and the problem in the pre-constructed problem library by utilizing the semantic question-answer model based on the query segmentation result to obtain a semantic recall result;
and the grading query module is used for carrying out relevance grading on the semantic recall result and obtaining a semantic query answer corresponding to the user query question according to the relevance grading result.
9. 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 semantic question-answering method according to any one of claims 1 to 7.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the semantic question-answering method according to any one of claims 1 to 7.
CN202310603965.9A 2023-05-26 2023-05-26 Semantic question-answering method, device, equipment and storage medium Pending CN116628162A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310603965.9A CN116628162A (en) 2023-05-26 2023-05-26 Semantic question-answering method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310603965.9A CN116628162A (en) 2023-05-26 2023-05-26 Semantic question-answering method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116628162A true CN116628162A (en) 2023-08-22

Family

ID=87596857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310603965.9A Pending CN116628162A (en) 2023-05-26 2023-05-26 Semantic question-answering method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116628162A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116911312A (en) * 2023-09-12 2023-10-20 深圳须弥云图空间科技有限公司 Task type dialogue system and implementation method thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116911312A (en) * 2023-09-12 2023-10-20 深圳须弥云图空间科技有限公司 Task type dialogue system and implementation method thereof
CN116911312B (en) * 2023-09-12 2024-01-05 深圳须弥云图空间科技有限公司 Task type dialogue system and implementation method thereof

Similar Documents

Publication Publication Date Title
WO2022141861A1 (en) Emotion classification method and apparatus, electronic device, and storage medium
CN113312461A (en) Intelligent question-answering method, device, equipment and medium based on natural language processing
CN112860848B (en) Information retrieval method, device, equipment and medium
CN113821622B (en) Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
CN113887941B (en) Business process generation method, device, electronic equipment and medium
CN112906377A (en) Question answering method and device based on entity limitation, electronic equipment and storage medium
CN115392237B (en) Emotion analysis model training method, device, equipment and storage medium
CN116662488A (en) Service document retrieval method, device, equipment and storage medium
CN110795544B (en) Content searching method, device, equipment and storage medium
CN116821373A (en) Map-based prompt recommendation method, device, equipment and medium
CN116628162A (en) Semantic question-answering method, device, equipment and storage medium
CN113344125B (en) Long text matching recognition method and device, electronic equipment and storage medium
CN114706985A (en) Text classification method and device, electronic equipment and storage medium
CN112632264A (en) Intelligent question and answer method and device, electronic equipment and storage medium
CN116450916A (en) Information query method and device based on fixed-segment classification, electronic equipment and medium
CN113705692B (en) Emotion classification method and device based on artificial intelligence, electronic equipment and medium
CN115346095A (en) Visual question answering method, device, equipment and storage medium
CN115510188A (en) Text keyword association method, device, equipment and storage medium
CN115098534A (en) Data query method, device, equipment and medium based on index weight lifting
CN115309865A (en) Interactive retrieval method, device, equipment and storage medium based on double-tower model
CN111914201B (en) Processing method and device of network page
CN114676307A (en) Ranking model training method, device, equipment and medium based on user retrieval
CN114139530A (en) Synonym extraction method and device, electronic equipment and storage medium
CN113672722B (en) Online course intelligent recommendation method and device, electronic equipment and storage medium
CN112528183B (en) Webpage component layout method and device based on big data, electronic equipment and medium

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