CN117591637A - Content extension and question reply method, device, system, equipment and medium - Google Patents

Content extension and question reply method, device, system, equipment and medium Download PDF

Info

Publication number
CN117591637A
CN117591637A CN202311367948.6A CN202311367948A CN117591637A CN 117591637 A CN117591637 A CN 117591637A CN 202311367948 A CN202311367948 A CN 202311367948A CN 117591637 A CN117591637 A CN 117591637A
Authority
CN
China
Prior art keywords
vector
document
candidate
question
content
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
CN202311367948.6A
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.)
Beijing Orion Star Technology Co Ltd
Original Assignee
Beijing Orion Star Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Orion Star Technology Co Ltd filed Critical Beijing Orion Star Technology Co Ltd
Priority to CN202311367948.6A priority Critical patent/CN117591637A/en
Publication of CN117591637A publication Critical patent/CN117591637A/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/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • G06F40/58Use of machine translation, e.g. for multi-lingual retrieval, for server-side translation for client devices or for real-time translation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application relates to a content extension and question reply method, device, system, equipment and medium, which are used for carrying out content extension on a dialogue system in an intelligent product so as to enable the dialogue system to answer questions presented by a user about a private knowledge base and improve user experience. The content extension method comprises the following steps: acquiring a document uploaded by a user; performing word vector conversion on the document to obtain a document vector corresponding to the document; and storing the document vector into a pre-established vector database, determining an alternative vector with the similarity to the question vector being greater than a preset similarity threshold value from the vector database when the question is replied, replying to the question based on at least one determined alternative vector, wherein the question vector is obtained by carrying out word vector conversion on the question.

Description

Content extension and question reply method, device, system, equipment and medium
Technical Field
The present application relates to the field of artificial intelligence, and in particular, to a method, apparatus, system, device, and medium for content extension and question answering.
Background
With the development of artificial intelligence technology, various intelligent products, such as intelligent customer service and intelligent robots, are widely used, and a dialogue system (or a question-answering system) configured in such intelligent products can perform dialogue with a user to answer questions posed by the user.
Currently, a dialogue system can answer questions in the related field usually based on pre-learned knowledge, but since the dialogue system does not know knowledge in the user's private knowledge base, the question-answer and dialogue of the user based on the private knowledge base cannot be satisfied, for example, the medical robot cannot answer questions about finance of the user.
Therefore, in the dialogue system of the intelligent product in the prior art, the user cannot answer the questions based on the private knowledge base, the dialogue function of the intelligent product is not fully utilized, and the use experience of the user is poor.
Disclosure of Invention
The embodiment of the application provides a content extension and question reply method, device, system, equipment and medium, which are used for carrying out content extension on a dialogue system in an intelligent product so as to enable the dialogue system to answer questions presented by a user about a private knowledge base and promote user experience.
In a first aspect, an embodiment of the present application provides a content extension method, which is applied to a dialogue system in an intelligent product, including:
Acquiring a document uploaded by a user;
performing word vector conversion on the document to obtain a document vector corresponding to the document;
and storing the document vector into a pre-established vector database, determining an alternative vector with the similarity to the question vector being greater than a preset similarity threshold value from the vector database when the question is replied, replying to the question based on at least one determined alternative vector, wherein the question vector is obtained by carrying out word vector conversion on the question.
In a possible implementation manner, in the method provided by the embodiment of the present application, the method further includes:
generating, using a large language model in the dialog system, extended content associated with the document, the extended content including at least one of: the method comprises the steps of abstracting the document, a plurality of document questions generated by asking the document, and a plurality of abstract questions generated by asking the abstract of the document;
word vector conversion is carried out on the extended content, and an extended content vector corresponding to the extended content is obtained;
the extended content vector is stored in the vector database.
In a possible implementation manner, in the method provided by the embodiment of the present application, the generating, by using a large language model in the dialog system, extended content associated with the document includes:
When the number of characters contained in the document is determined to be larger than a preset number threshold, segmenting the document into a plurality of document fragments;
if the extension content comprises the abstract of the document, generating multi-level abstracts corresponding to the plurality of document fragments by using the large language model;
if the extension content comprises a plurality of document questions generated by asking questions of the document, asking questions of each document fragment by using the large language model to generate the document questions corresponding to each document fragment;
if the extended content comprises a plurality of abstract questions generated by asking the abstract of the document, generating multi-level abstract corresponding to the plurality of document fragments by using the large language model, asking each abstract, and generating abstract questions corresponding to each abstract;
wherein each level of the multi-level summaries comprises at least one summary, and each summary is generated based on at least one document fragment or at least one summary in the previous level.
In a possible implementation manner, in the method provided by the embodiment of the present application, the method further includes:
acquiring meta information of the document;
generating meta information of the extended content based on the meta information of the document;
And storing the meta information of the document corresponding to the document vector and the meta information of the extended content corresponding to the extended content vector in the vector database.
In a possible implementation manner, in the above method provided by the embodiment of the present application, after the obtaining a document uploaded by a user, the method further includes:
converting the document and the extension content into the same other languages respectively by using the large language model;
word vector conversion is respectively carried out on the converted document and the converted extension content, so as to obtain a document vector corresponding to the converted document and an extension content vector corresponding to the converted extension content;
and storing a document vector corresponding to the converted document and an extended content vector corresponding to the converted extended content in the vector database.
In a second aspect, an embodiment of the present application provides a method for replying to a question, including:
acquiring a problem proposed by a user;
performing word vector conversion on the problem to obtain a corresponding problem vector;
in a pre-established vector database, determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold, wherein at least one document vector is stored in the vector database, and the document vector is generated by performing word vector conversion on a document acquired by history;
When at least one candidate vector is determined, the question is replied to based on the candidate vector.
In a possible implementation manner, in the method provided in the embodiment of the present application, the vector database further includes: an extended content vector generated by word vector conversion of extended content generated based on a history-acquired document, the extended content comprising at least one of: the method comprises the steps of abstracting a document obtained by history, a plurality of document questions generated by asking the document obtained by history, and a plurality of abstract questions generated by asking the abstract;
the determining, in a pre-established vector database, an alternative vector having a similarity to the problem vector greater than a preset similarity threshold, includes:
and determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold value from the document vector and the extended content vector included in the vector database.
In a possible implementation manner, in the method provided by the embodiment of the present application, when determining at least one candidate vector, replying to the problem based on the candidate vector includes:
When the determined candidate vectors are multiple, selecting a preset number of candidate vectors from the multiple candidate vectors based on a preset strategy, and replying to the problem based on the preset number of candidate vectors.
In a possible implementation manner, in the above method provided by the embodiment of the present application, the preset policy includes at least one of the following:
based on the similarity between each candidate vector and the problem vector, performing descending arrangement on the determined candidate vectors to obtain an arrangement result, and selecting a preset number of candidate vectors from the arrangement result;
selecting a first number of candidate vectors from candidate vectors of which the types are document vectors, and selecting a second number of candidate vectors from candidate vectors of which the types are expanded content vectors, wherein the sum of the first number and the second number is the preset number;
if the candidate vectors correspondingly store meta information, determining meta information corresponding to any candidate vector, determining a document set to which a document to which the candidate vector belongs based on the meta information, and selecting a preset number of candidate vectors from the candidate vectors generated in the document set.
In a possible implementation manner, in the method provided in the embodiment of the present application, the vector database further includes: storing meta information of the document corresponding to the document vector, and storing meta information of the extended content corresponding to the extended content vector;
The replying to the question based on the candidate vector comprises:
determining a source document or a source abstract to which the candidate vector belongs based on the meta information stored correspondingly by the candidate vector;
generating a prompt word based on the source document or the source abstract, and sending the prompt word to a large language model in the dialogue system so that the large language model replies to the problem based on the prompt word.
In a possible implementation manner, in the method provided by the embodiment of the present application, the determining, based on meta information stored in correspondence with the candidate vector, a source document or a source abstract to which the candidate vector belongs includes:
if the candidate vector is a document vector, determining a source document to which the document vector belongs based on meta information corresponding to the document vector;
if the candidate vector is a summary vector, determining a source summary to which the summary vector belongs based on meta information corresponding to the summary vector;
if the candidate vector is a document problem vector, determining a source document to which the document problem vector belongs based on meta information corresponding to the document problem vector;
and if the candidate vector is a summary problem vector, determining a source summary to which the summary problem vector belongs based on meta information corresponding to the summary problem vector.
In a third aspect, an embodiment of the present application provides a content extension apparatus, including:
the acquisition unit is used for acquiring the document uploaded by the user;
the processing unit is used for carrying out word vector conversion on the document to obtain a document vector corresponding to the document;
and the storage unit is used for storing the document vector into a pre-established vector database, determining an alternative vector with the similarity greater than a preset similarity threshold value with the problem vector from the vector database when the problem is replied, replying the problem based on at least one determined alternative vector, and carrying out word vector conversion on the problem.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the processing unit is further configured to:
generating, using a large language model in the dialog system, extended content associated with the document, the extended content including at least one of: the method comprises the steps of abstracting the document, a plurality of document questions generated by asking the document, and a plurality of abstract questions generated by asking the abstract of the document;
word vector conversion is carried out on the extended content, and an extended content vector corresponding to the extended content is obtained;
The memory unit is further configured to: the extended content vector is stored in the vector database.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the processing unit is specifically configured to:
when the number of characters contained in the document is determined to be larger than a preset number threshold, segmenting the document into a plurality of document fragments;
if the extension content comprises the abstract of the document, generating multi-level abstracts corresponding to the plurality of document fragments by using the large language model;
if the extension content comprises a plurality of document questions generated by asking questions of the document, asking questions of each document fragment by using the large language model to generate the document questions corresponding to each document fragment;
if the extended content comprises a plurality of abstract questions generated by asking the abstract of the document, generating multi-level abstract corresponding to the plurality of document fragments by using the large language model, asking each abstract, and generating abstract questions corresponding to each abstract;
wherein each level of the multi-level summaries comprises at least one summary, and each summary is generated based on at least one document fragment or at least one summary in the previous level.
In one possible implementation, in the above device provided by the examples of the present application,
the acquisition unit is further configured to: acquiring meta information of the document;
the processing unit is further configured to: generating meta information of the extended content based on the meta information of the document;
the storage unit is further configured to: and storing the meta information of the document corresponding to the document vector and the meta information of the extended content corresponding to the extended content vector in the vector database.
In one possible implementation, in the above device provided by the examples of the present application,
the processing unit is further configured to: converting the document and the extension content into the same other languages respectively by using the large language model;
word vector conversion is respectively carried out on the converted document and the converted extension content, so as to obtain a document vector corresponding to the converted document and an extension content vector corresponding to the converted extension content;
the storage unit is further configured to: and storing a document vector corresponding to the converted document and an extended content vector corresponding to the converted extended content in the vector database.
In a fourth aspect, an embodiment of the present application provides a question answering apparatus, including:
An acquisition unit for acquiring a question posed by a user;
the first processing unit is used for carrying out word vector conversion on the problems to obtain corresponding problem vectors;
the second processing unit is used for determining an alternative vector with the similarity to the problem vector being larger than a preset similarity threshold in a pre-established vector database, wherein at least one document vector is stored in the vector database, and the document vector is generated by performing word vector conversion on a document acquired by history;
and the replying unit is used for replying to the problem based on the alternative vector when at least one alternative vector is determined.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the vector database further includes: an extended content vector generated by word vector conversion of extended content generated based on a history-acquired document, the extended content comprising at least one of: the method comprises the steps of abstracting a document obtained by history, a plurality of document questions generated by asking the document obtained by history, and a plurality of abstract questions generated by asking the abstract;
The second processing unit is specifically configured to:
and determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold value from the document vector and the extended content vector included in the vector database.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the reply unit is specifically configured to:
when the determined candidate vectors are multiple, selecting a preset number of candidate vectors from the multiple candidate vectors based on a preset strategy, and replying to the problem based on the preset number of candidate vectors.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the preset policy includes at least one of the following:
based on the similarity between each candidate vector and the problem vector, performing descending arrangement on the determined candidate vectors to obtain an arrangement result, and selecting a preset number of candidate vectors from the arrangement result;
selecting a first number of candidate vectors from candidate vectors of which the types are document vectors, and selecting a second number of candidate vectors from candidate vectors of which the types are expanded content vectors, wherein the sum of the first number and the second number is the preset number;
If the candidate vectors correspondingly store meta information, determining meta information corresponding to any candidate vector, determining a document set to which a document to which the candidate vector belongs based on the meta information, and selecting a preset number of candidate vectors from the candidate vectors generated in the document set.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the reply unit is specifically configured to:
also included in the vector database is: storing the meta information of the document corresponding to the document vector, and determining a source document or a source abstract to which the candidate vector belongs based on the meta information stored corresponding to the candidate vector when the meta information of the extended content is stored corresponding to the extended content vector;
generating a prompt word based on the source document or the source abstract, and sending the prompt word to a large language model in the dialogue system so that the large language model replies to the problem based on the prompt word.
In a possible implementation manner, in the foregoing apparatus provided by the embodiment of the present application, the reply unit is specifically configured to:
if the candidate vector is a document vector, determining a source document to which the document vector belongs based on meta information corresponding to the document vector;
If the candidate vector is a summary vector, determining a source summary to which the summary vector belongs based on meta information corresponding to the summary vector;
if the candidate vector is a document problem vector, determining a source document to which the document problem vector belongs based on meta information corresponding to the document problem vector;
and if the candidate vector is a summary problem vector, determining a source summary to which the summary problem vector belongs based on meta information corresponding to the summary problem vector.
In a fifth aspect, embodiments of the present application provide a dialog system, including:
the first acquisition module is used for acquiring the document uploaded by the user;
the first processing module is used for carrying out word vector conversion on the document to obtain a document vector corresponding to the document;
the storage module is used for storing the document vector into a pre-established vector database;
the second acquisition module is used for acquiring the problem proposed by the user;
the second processing module is used for carrying out word vector conversion on the problem to obtain a corresponding problem vector, and determining an alternative vector with similarity greater than a preset similarity threshold value with the problem vector in a pre-established vector database;
And the replying module is used for replying to the problem based on the alternative vector when at least one alternative vector is determined.
In a sixth aspect, an embodiment of the present application provides an electronic device, including: at least one processor, at least one memory and computer program instructions stored in the memory, which when executed by the processor, implement the method as provided by the first and/or second aspect of embodiments of the present application.
In a seventh aspect, embodiments of the present application provide a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement a method as provided in the first and/or second aspects of embodiments of the present application.
According to the content extension, question reply method, device, system, equipment and medium, after the document uploaded by the user is obtained, word vector conversion is carried out on the document, a document vector corresponding to the document is obtained, and the document vector is stored in a pre-established vector database. Therefore, when a question is replied, word vector conversion can be carried out on the question to obtain a corresponding question vector, an alternative vector with the similarity greater than a preset similarity threshold value with the question vector is determined in a vector database, and when at least one alternative vector is determined, the question is replied based on the alternative vector.
According to the method and the device, the document uploaded by the user can be a document in the private knowledge base of the user, the document vector is obtained through word vector conversion on the document and stored, so that after the dialogue system obtains the problem raised by the user, if the problem is a problem about the private knowledge base, the dialogue system can search for the alternative vector based on the similarity between the problem vector and the stored document vector and answer the problem raised by the user based on the alternative vector, the function of the dialogue system is expanded, the problem raised by the user about the private knowledge base can be answered, and the user experience is improved.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
Fig. 1 is an alternative schematic diagram of an application scenario in an embodiment of the present application;
FIG. 2 is a schematic flow chart of a content extension method provided in an embodiment of the present application;
FIG. 3 is a schematic flow chart of a method for replying to questions provided in an embodiment of the present application;
Fig. 4 is a schematic structural diagram of a content extension device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a question answering apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a dialogue system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of another electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the technical solutions of the present application, but not all embodiments. All other embodiments, which can be made by a person of ordinary skill in the art without any inventive effort, based on the embodiments described in the present application are intended to be within the scope of the technical solutions of the present application.
The following briefly describes the design concept of the embodiment of the present application:
with the development of artificial intelligence technology, various intelligent products, such as intelligent customer service and intelligent robots, are widely used, and a dialogue system (or a question-answering system) configured in such intelligent products can perform dialogue with a user to answer questions posed by the user.
Currently, a dialogue system can answer questions in the related field usually based on pre-learned knowledge, but since the dialogue system does not know knowledge in the user's private knowledge base, the question-answer and dialogue of the user based on the private knowledge base cannot be satisfied, for example, the medical robot cannot answer questions about finance of the user.
Therefore, in the dialogue system of the intelligent product in the prior art, the user cannot answer the questions based on the private knowledge base, the dialogue function of the intelligent product is not fully utilized, and the use experience of the user is poor.
In view of this, the embodiments of the present application provide a method, an apparatus, a system, a device, and a medium for content extension and question answering, which perform word vector conversion on a document after obtaining a document uploaded by a user, obtain a document vector corresponding to the document, and store the document vector in a pre-established vector database. Therefore, when a question is replied, word vector conversion can be carried out on the question to obtain a corresponding question vector, an alternative vector with the similarity greater than a preset similarity threshold value with the question vector is determined in a vector database, and when at least one alternative vector is determined, the question is replied based on the alternative vector.
According to the method and the device, the document uploaded by the user can be a document in the private knowledge base of the user, the document vector is obtained through word vector conversion on the document and stored, so that after the dialogue system obtains the problem raised by the user, if the problem is a problem about the private knowledge base, the dialogue system can search for the alternative vector based on the similarity between the problem vector and the stored document vector and answer the problem raised by the user based on the alternative vector, the function of the dialogue system is expanded, the problem raised by the user about the private knowledge base can be answered, and the user experience is improved.
The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it being understood that the preferred embodiments described herein are for illustration and explanation only, and are not intended to limit the present application, and embodiments and features of embodiments of the present application may be combined with each other without conflict.
Fig. 1 is a schematic view of an application scenario in an embodiment of the present application. Any one of the plurality of smart products 110 and any one of the plurality of servers 120 are included in the application scenario diagram.
In the present embodiment, smart products 110 include, but are not limited to, cell phones, computers, smart robots, etc.; the server 120 is a background server of the intelligent product. The server 120 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligence platform.
Note that, the content extension method and the question answering method in the embodiment of the present application may be executed by the server 120 or may be executed by the smart product 110, which is not limited in the embodiment of the present application.
Taking the execution in the intelligent product 110 as an example, after the intelligent product 110 acquires the document uploaded by the user, word vector conversion is performed on the document to obtain a document vector corresponding to the document, and the document vector is stored in a pre-established vector database.
After the intelligent product 110 obtains the problem posed by the user, word vector conversion can be performed on the problem to obtain a corresponding problem vector, an alternative vector with similarity greater than a preset similarity threshold value with the problem vector is determined in a vector database, and then the problem is replied based on the alternative vector when at least one alternative vector is determined.
In an alternative embodiment, the smart product 110 and the server 120 may communicate over a communication network, which may be a wired network or a wireless network.
It should be noted that, the number of intelligent products and servers and the communication manner are not limited in practice, and when the number of servers is plural, plural servers may be configured as a blockchain, and the servers are nodes on the blockchain, which is not specifically limited in the embodiment of the present application.
The content extension method and the question answering method provided in the exemplary embodiments of the present application are described below with reference to the accompanying drawings in conjunction with the above-described application scenario, and it should be noted that the above-described application scenario is only shown for the convenience of understanding the spirit and principles of the present application, and embodiments of the present application are not limited in any way in this respect.
As shown in fig. 2, a flowchart of an implementation of a content extension method in an embodiment of the present application is shown in the following specific implementation flows of the method S201-S203:
s201, acquiring a document uploaded by a user.
In practical application, each user can upload a plurality of documents, and the same intelligent product can have a plurality of users uploading different documents, wherein the documents uploaded by the users can be documents in a private knowledge base, the documents are a text and can be from an article or a book, and the embodiment of the application is not limited to the text.
S202, performing word vector conversion on the document to obtain a document vector corresponding to the document.
In particular, the word vector conversion may be performed on a document using an existing word vector conversion model, for example: word2vec, et al, which is not limited in this embodiment.
S203, storing the document vector into a pre-established vector database, determining an alternative vector with the similarity greater than a preset similarity threshold value with the question vector from the vector database when the question is answered, and replying the question based on at least one determined alternative vector, wherein the question vector is obtained by carrying out word vector conversion on the question.
In particular embodiments, to facilitate retrieval of alternative vectors in a vector database, embodiments of the present application may also utilize a large language model in a dialog system to generate expanded content associated with a document, the expanded content including at least one of: the method comprises the steps of abstracting a document, a plurality of document questions generated by asking the document, and a plurality of abstract questions generated by asking the abstract of the document, performing word vector conversion on the extended content to obtain an extended content vector corresponding to the extended content, and storing the extended content vector in a vector database. The word vector conversion is performed on the extended content, and the existing word vector conversion model can be used as well, for example: word2vec, et al, which is not limited in this embodiment.
The large language model may be a large language model contained in the intelligent product dialogue system or other existing large language models, which is not limited in the embodiment of the present application.
In practical application, since the large language model generally has limitation of input characters, if the number of characters contained in the document uploaded by the user is greater than a preset number threshold, the document may be segmented into a plurality of document segments, where the preset number threshold may be set according to the maximum number of input characters supported by the large language model, for example, the maximum number of input characters supported by the large language model is 100, the preset number threshold may be set to 100 or 99, and the like, and the existing segmentation method may be adopted to segment the document into a plurality of document segments.
After segmenting a document into a plurality of document fragments, when generating extended content associated with the document using a large language model in a dialog system, the following are specifically included:
and 1, generating multi-level summaries corresponding to a plurality of document fragments by using a large language model when the extended content comprises the summaries of the documents, wherein each level of the multi-level summaries comprises at least one summary, and each summary is generated based on at least one document fragment or at least one summary in the previous level.
In specific implementation, when generating the next-level abstract based on at least one document segment or at least one abstract in the previous level, the number of the selected document segments or the number of the abstracts can be flexibly set based on the length of each document segment or each abstract and the maximum number of input characters supported by the large language model, which is not limited in the embodiment of the present application.
In one example, assuming that the document C is segmented into a plurality of document segments C1, C2, C3, C4 and C5, when generating the digests corresponding to the document segments, the first-level digests may generate digests corresponding to (C1, C2, C3), (C2, C3, C4) and (C3, C4, C5) respectively, to obtain three first-level digests of S1-1, S1-2 and S1-3, the second-level digests may generate digests corresponding to (S1-1, S1-2) and (S1-2, S1-3) respectively, to obtain two second-level digests of S2-1 and S2-2, and the third-level digests may generate digests corresponding to (S2-1, S2-2) to obtain one third-level digest S3-1.
In another example, still assuming that the document C is segmented into a plurality of document segments C1, C2, C3, C4 and C5, when generating the digests corresponding to the document segments, the first-level digests may generate digests corresponding to (C1, C2), (C2, C3), (C3, C4) and (C4, C5), respectively, to obtain four first-level digests of X1-1, X1-2, X1-3 and X1-4, the second-level digests may generate digests corresponding to (X1-1, X1-2), (X1-2, X1-3) and (X1-3, X1-4), respectively, to obtain three second-level digests of X2-1, X2-2 and X2-3, to obtain two third-level digests of X3-1 and X3-2, to obtain the fourth-level digests of (X2-1, X2-2) and X3-2, to obtain the fourth-level digests of (X1-3, X3-3) and X1-4.
When the document is divided into a plurality of document segments, a multi-level abstract is generated for the plurality of document segments, so that after abstract vectors corresponding to the multi-level abstract are stored, questions raised by a user can be obtained, and when candidate vectors are searched in the abstract vectors based on the question vectors corresponding to the questions raised by the user, the searching times are reduced, and the searching efficiency is improved.
In case 2, if the extension content includes a plurality of document questions generated by asking a question of a document, a large language model is used to ask a question of each document segment, and a document question corresponding to each document segment is generated, where the document question corresponding to each document segment may be one or a plurality of document questions, and the embodiment of the present application does not limit the document questions.
In case 3, if the extended content includes a plurality of abstract questions generated by asking questions for the abstract of the document, generating a plurality of levels of abstract corresponding to the plurality of document fragments by using a large language model, asking questions for each abstract, and generating abstract questions corresponding to each abstract, where the abstract questions corresponding to each abstract may be one or a plurality of, and the embodiment of the application does not limit the abstract questions.
The method for generating the multi-level abstracts corresponding to the plurality of document segments by using the large language model can be the method described in the above case 1, and will not be described here again.
In practical application, in order to conveniently classify the document, determine the document set to which the document belongs, in the embodiment of the present application, the meta information of the document may also be obtained, and based on the meta information of the document, the meta information of the extended content may be generated, then in the vector database, the meta information of the document is stored corresponding to the document vector, the meta information of the extended content is stored corresponding to the extended content vector, and the index is established.
Among them, meta information may include, but is not limited to: text content, information summarization algorithm md5 value of text, document author, document title, document identification, document source, source type, summary related information, etc.
In addition, in order to support multiple languages, after the document uploaded by the user is acquired, the large language model may be used to convert the document and the extension content into the same other languages respectively, and word vector conversion is performed on the converted document and the converted extension content respectively to obtain a document vector corresponding to the converted document and an extension content vector corresponding to the converted extension content, and then the document vector corresponding to the converted document and the extension content vector corresponding to the converted extension content are stored in the vector database.
It should be noted that, the document and the extended content may be converted into versions in a plurality of languages, and each time of conversion, the document and the extended content may be respectively converted into the same language.
Accordingly, as shown in fig. 3, the embodiment of the present application further provides a method for replying to a question, including:
s301, acquiring a problem proposed by a user.
In specific implementation, the problem proposed by the user may be a problem proposed by the receiving user in a voice form or a text form, which is not limited in the embodiment of the present application.
S302, performing word vector conversion on the questions to obtain corresponding question vectors.
In specific implementation, word vector conversion is performed on the problem, and an existing word vector conversion model may be used as well, for example: word2vec, et al, which is not limited in this embodiment.
S303, determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold in a pre-established vector database, wherein at least one document vector is stored in the vector database, and the document vector is generated by performing word vector conversion on the document acquired by history.
In the implementation, after obtaining the problem vector corresponding to the problem presented by the user, an alternative vector with similarity greater than a preset similarity threshold value with the problem vector can be determined in the document vectors stored in the vector database.
S304, replying to the problem based on the candidate vectors when at least one candidate vector is determined.
In specific implementation, if the candidate vector is not determined, the problem raised by the user may not relate to the document uploaded by the user, and the dialogue system of the intelligent product may reply in other manners, for example, reply to the problem raised by the user by using general domain knowledge, and the reply manner of the situation is not limited in the application.
In specific implementation, the vector database may further include: an extended content vector generated by performing word vector conversion on extended content generated based on the history-acquired document, the extended content including at least one of: the method comprises the steps of abstracting a document obtained by history, a plurality of document questions generated by questioning the document obtained by history, and a plurality of abstract questions generated by questioning the abstract; then in a pre-established vector database, determining an alternative vector having a similarity to the problem vector greater than a pre-set similarity threshold, comprising: and determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold value from the document vector and the extended content vector included in the vector database.
When the vector database includes the extended content vector, in the implementation, after obtaining the problem vector corresponding to the problem presented by the user, the candidate vector with the similarity greater than the preset similarity threshold value with the problem vector can be determined in the document vector and the extended content vector stored in the vector database.
In practical applications, if the extended content vector includes: when determining the candidate vector, a first candidate vector can be determined in the document vector, a second candidate vector can be determined in the abstract vector, a third candidate vector can be determined in the document problem, a fourth candidate vector can be determined in the abstract problem vector, and then the determined first candidate vector, second candidate vector, third candidate vector and fourth candidate vector are taken as the determined candidate vectors.
In the implementation, if one candidate vector is determined, the problem posed by the user is replied based on the determined candidate vector, if the determined candidate vector is a plurality of candidate vectors, a preset number of candidate vectors are selected from the plurality of candidate vectors based on a preset strategy, and the problem is replied based on the selected preset number of candidate vectors.
Specifically, when a preset number of candidate vectors are selected from a plurality of candidate vectors based on a preset strategy, the preset strategy may include at least one of the following:
and (3) strategy 1, based on the similarity between each candidate vector and the problem vector, performing descending arrangement on the determined candidate vectors to obtain an arrangement result, and selecting a preset number of candidate vectors in the arrangement result.
Policy 2, selecting a first number of candidate vectors from candidate vectors with the type of document vectors, selecting a second number of candidate vectors from candidate vectors with the type of extended content vectors, wherein the sum of the first number and the second number is a preset number.
In one example, assume that the extended content vector includes: the method comprises the steps of selecting 2 candidate vectors from candidate vectors with the type of document vectors, selecting 2 candidate vectors from candidate vectors with the type of abstract vectors, selecting 1 candidate vector from candidate vectors with the type of document problem vectors, selecting 1 candidate vector from candidate vectors with the type of abstract problem vectors, and selecting 6 candidate vectors in total if the preset number is 6.
And 3, if the candidate vectors correspondingly store the meta information, determining the meta information corresponding to any candidate vector, determining a document set to which the document to which the candidate vector belongs based on the meta information, and selecting a preset number of candidate vectors from the candidate vectors generated by the documents in the document set.
In the specific implementation, according to the meta information corresponding to the candidate vectors, a document set to which the documents to which the candidate vectors belong belongs is determined, and then a preset number of candidate vectors are selected from the candidate vectors generated in the document set, so that the selection range of the candidate vectors can be reduced, and the selection accuracy of the candidate vectors can be improved.
For example, if the document author is Zhang three in meta-information corresponding to a certain candidate vector, all documents whose document authors are Zhang three may be determined based on the meta-information to form a document set, and then a preset number of candidate vectors are selected from all the associated candidate vectors based on the documents whose document author is Zhang three.
In specific implementation, the vector database further comprises: when the meta information of the document is stored corresponding to the document vector and the meta information of the extended content is stored corresponding to the extended content vector, the problem can be replied based on the alternative vector, a source document or a source abstract to which the alternative vector belongs can be determined based on the meta information stored corresponding to the alternative vector, and then a prompt word is generated based on the source document or the source abstract, and the prompt word is sent to a large language model in a dialogue system, so that the large language model replies to the problem based on the prompt word.
In particular, the meta information may include, but is not limited to: text content, information summarization algorithm md5 value of text, document author, document title, document identification, document source, source type, summary related information, etc.
If the candidate vector is a document vector, determining the source document to which the candidate vector belongs based on meta information corresponding to the document vector, and determining the source document to which the candidate vector belongs directly based on text content in the meta information.
If the candidate vector is a summary vector, when determining the source summary to which the summary vector belongs based on meta information corresponding to the summary vector, the source summary to which the candidate vector belongs can be determined directly based on text content in the meta information.
If the candidate vector is a document problem vector, determining a source document to which the document problem vector belongs based on meta information corresponding to the document problem vector, and determining the source document to which the candidate vector belongs based on a document author, a document title, a document identification or the like in the meta information.
If the candidate vector is a summary problem vector, when determining a source summary to which the summary problem vector belongs based on meta information corresponding to the summary problem vector, determining the source summary to which the candidate vector belongs based on information related to the summary in the meta information.
Based on the same inventive concept, as shown in fig. 4, the embodiment of the present application further provides a content extension apparatus, including:
an obtaining unit 401, configured to obtain a document uploaded by a user;
a processing unit 402, configured to perform word vector conversion on a document to obtain a document vector corresponding to the document;
a storage unit 403, configured to store the document vector in a pre-established vector database, so as to determine, when replying to the question, an alternative vector having a similarity with the question vector greater than a preset similarity threshold from the vector database, and reply to the question based on the determined at least one alternative vector, where the question vector is obtained by performing word vector conversion on the question.
In a possible implementation, the processing unit 402 is further configured to:
generating, using a large language model in the dialog system, extended content associated with the document, the extended content including at least one of: the method comprises the steps of abstracting a document, a plurality of document questions generated by questioning the document, and a plurality of abstract questions generated by questioning the abstract of the document;
word vector conversion is carried out on the extended content, and an extended content vector corresponding to the extended content is obtained;
the memory unit is further configured to: the extended content vector is stored in a vector database.
In one possible implementation, the processing unit 402 is specifically configured to:
when the number of characters contained in the document is determined to be larger than a preset number threshold, segmenting the document into a plurality of document fragments;
if the extension content comprises the abstract of the document, generating multi-level abstracts corresponding to a plurality of document fragments by using a large language model;
if the extension content comprises a plurality of document questions generated by asking the document, asking each document fragment by using a large language model to generate a document question corresponding to each document fragment;
if the extended content comprises a plurality of abstract questions generated by asking the abstract of the document, generating multi-level abstract corresponding to a plurality of document fragments by using a large language model, asking each abstract, and generating abstract questions corresponding to each abstract;
wherein each level of the multi-level summaries comprises at least one summary, and each summary is generated based on at least one document fragment or at least one summary in the previous level.
In a possible implementation manner, the obtaining unit 401 is further configured to: acquiring meta information of a document;
the processing unit 402 is further configured to: generating meta information of the extended content based on the meta information of the document;
The storage unit 403 is further configured to: in the vector database, meta information of a document is stored in correspondence with a document vector, and meta information of extended content is stored in correspondence with an extended content vector.
In one possible implementation, the processing unit 402 is further configured to: respectively converting the document and the extension content into the same other languages by using a large language model;
word vector conversion is respectively carried out on the converted document and the converted extension content, so as to obtain a document vector corresponding to the converted document and an extension content vector corresponding to the converted extension content;
the storage unit 403 is further configured to: and storing a document vector corresponding to the converted document and an extended content vector corresponding to the converted extended content in a vector database.
Based on the same inventive concept, as shown in fig. 5, the embodiment of the present application further provides a question answering apparatus, including:
an obtaining unit 501, configured to obtain a problem posed by a user;
the first processing unit 502 is configured to perform word vector conversion on a problem to obtain a corresponding problem vector;
a second processing unit 503, configured to determine, in a pre-established vector database, an alternative vector having a similarity with the problem vector greater than a preset similarity threshold, where at least one document vector is stored in the vector database, where the document vector is generated by performing word vector conversion on a document obtained by history;
A reply unit 504 for replying to the question based on the candidate vector when at least one candidate vector is determined.
In one possible implementation, the vector database further includes: an extended content vector generated by performing word vector conversion on extended content generated based on the history-acquired document, the extended content including at least one of: the method comprises the steps of abstracting a document obtained by history, a plurality of document questions generated by questioning the document obtained by history, and a plurality of abstract questions generated by questioning the abstract;
the second processing unit 503 is specifically configured to:
and determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold value from the document vector and the extended content vector included in the vector database.
In a possible implementation, the reply unit 504 is specifically configured to:
when the determined candidate vectors are multiple, selecting a preset number of candidate vectors from the multiple candidate vectors based on a preset strategy, and replying to the problem based on the preset number of candidate vectors.
In one possible embodiment, the preset strategy includes at least one of the following:
based on the similarity between each candidate vector and the problem vector, performing descending order arrangement on the determined candidate vectors to obtain an arrangement result, and selecting a preset number of candidate vectors in the arrangement result;
Selecting a first number of candidate vectors from candidate vectors of the type document vector, selecting a second number of candidate vectors from candidate vectors of the type extended content vector, and summing the first number and the second number to be a preset number;
if the candidate vectors correspondingly store the meta information, the meta information corresponding to any candidate vector is determined, a document set to which the documents to which the candidate vectors belong belongs is determined based on the meta information, and a preset number of candidate vectors are selected from the candidate vectors generated by the documents in the document set.
In a possible implementation, the reply unit 504 is specifically configured to:
also included in the vector database is: storing the meta information of the document corresponding to the document vector, and determining a source document or a source abstract to which the candidate vector belongs based on the meta information stored corresponding to the candidate vector when the meta information of the extended content is stored corresponding to the extended content vector;
generating a prompt word based on the source document or the source abstract, and sending the prompt word to a large language model in the dialogue system so that the large language model replies to the problem based on the prompt word.
In a possible implementation, the reply unit 504 is specifically configured to:
if the candidate vector is a document vector, determining a source document to which the document vector belongs based on meta information corresponding to the document vector;
If the candidate vector is a summary vector, determining a source summary to which the summary vector belongs based on meta information corresponding to the summary vector;
if the candidate vector is a document problem vector, determining a source document to which the document problem vector belongs based on meta information corresponding to the document problem vector;
if the candidate vector is the abstract problem vector, determining a source abstract to which the abstract problem vector belongs based on meta information corresponding to the abstract problem vector.
Based on the same inventive concept, as shown in fig. 6, the embodiment of the present application further provides a dialogue system, including:
a first obtaining module 601, configured to obtain a document uploaded by a user;
the first processing module 602 is configured to perform word vector conversion on a document to obtain a document vector corresponding to the document;
a storage module 603 for storing the document vector in a pre-established vector database;
a second obtaining module 604, configured to obtain a question posed by a user;
the second processing module 605 is configured to perform word vector conversion on the problem to obtain a corresponding problem vector, and determine, in a pre-established vector database, an alternative vector having a similarity with the problem vector greater than a preset similarity threshold;
a reply module 606 for replying to the question based on the candidate vectors when at least one candidate vector is determined.
The embodiment of the application also provides electronic equipment based on the same inventive concept as the embodiment of the method. The electronic equipment can process the document uploaded by the user, and further can answer the questions about the private knowledge base, which are presented by the user. In one embodiment, the electronic device may be a server, such as server 120 shown in FIG. 1. In this embodiment, the electronic device may be configured as shown in fig. 7, including a memory 701, a communication module 703, and one or more processors 702.
Memory 701 for storing a computer program for execution by processor 702. The memory 701 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, a program required for running an instant communication function, and the like; the storage data area can store various instant messaging information, operation instruction sets and the like.
The memory 701 may be a volatile memory (RAM), such as a random-access memory (RAM); the memory 701 may also be a nonvolatile memory (non-volatile memory), such as a read-only memory (rom), a flash memory (flash memory), a hard disk (HDD) or a Solid State Drive (SSD); or memory 701 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. Memory 701 may be a combination of the above.
The processor 702 may include one or more central processing units (central processing unit, CPU) or digital processing units, or the like. A processor 702 for implementing the content extension method and/or the question answering method described above when calling the computer program stored in the memory 701.
The communication module 703 is used for communicating with a terminal device and other servers.
The specific connection medium between the memory 701, the communication module 703, and the processor 702 is not limited in the embodiments of the present application. The embodiments of the present disclosure are illustrated in fig. 7 by a bus 704 between a memory 701 and a processor 702, where the bus 704 is indicated by a bold line in fig. 7, and the connection between other components is merely illustrative and not limiting. The bus 704 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 7, but not only one bus or one type of bus.
The memory 701 stores therein a computer storage medium having stored therein computer executable instructions for implementing the content extension method and/or the question answering method of the embodiments of the present application. The processor 702 is configured to perform the content extension method and/or the question answering method described above, as shown in fig. 2 or 3.
In another embodiment, the electronic device may be other electronic devices, such as the smart product 110 shown in FIG. 1. In this embodiment, the structure of the electronic device may include, as shown in fig. 8: communication component 810, memory 820, display unit 830, camera 840, sensor 850, audio circuit 860, bluetooth module 870, processor 880, and the like.
The communication component 810 is for communicating with a server. In some embodiments, a circuit wireless fidelity (Wireless Fidelity, wiFi) module may be included, where the WiFi module belongs to a short-range wireless transmission technology, and the electronic device may help the user to send and receive information through the WiFi module.
Memory 820 may be used to store software programs and data. Processor 880 performs various functions and data processing of intelligent product 110 by executing software programs or data stored in memory 820. Memory 820 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Memory 820 stores an operating system that enables smart product 110 to operate. Memory 820 may store an operating system and various applications, as well as code to perform the content extension method and/or the question-answering method of embodiments of the present application.
The display unit 830 may also be used to display information input by a user or information provided to the user and a graphical user interface (graphical user interface, GUI) of various menus of the smart product 110. In particular, the display unit 830 may include a display 832 disposed on the front of the smart product 110. The display 832 may be configured in the form of a liquid crystal display, light emitting diodes, or the like. The display unit 830 may be used to present images or text in embodiments of the present application.
The display unit 830 may also be used to receive input numeric or character information, generate signal inputs related to user settings and function controls of the smart product 110, and in particular, the display unit 830 may include a touch screen 831 disposed on the front of the smart product 110, and may collect touch operations on or near the user, such as clicking buttons, dragging scroll boxes, and the like.
The touch screen 831 may cover the display screen 832, or the touch screen 831 may be integrated with the display screen 832 to implement input and output functions of the intelligent product 110, and the integrated touch screen may be simply referred to as a touch screen. The display unit 830 may display an application program and corresponding operation steps.
The camera 840 may be used to capture still images, and a user may send images captured by the camera 840 to a chat partner user via a client. The camera 840 may be one or more. The object generates an optical image through the lens and projects the optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive elements convert the optical signals to electrical signals, which are then transferred to a processor 880 for conversion to digital image signals.
The smart product may also include at least one sensor 850, such as an acceleration sensor 851, a distance sensor 852, a fingerprint sensor 853, a temperature sensor 854. The smart product 110 may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, light sensors, motion sensors, and the like.
Audio circuitry 860, speaker 861, microphone 862 may provide an audio interface between the user and the smart product 110. The audio circuit 860 may transmit the received electrical signal converted from audio data to the speaker 861, and the electrical signal is converted into a sound signal by the speaker 861 and output. The smart product 110 may also be configured with a volume button for adjusting the volume of the sound signal. On the other hand, microphone 862 converts the collected sound signals into electrical signals, which are received by audio circuitry 860 and converted into audio data, which are output to communication component 810 for transmission to, for example, another smart product 110, or to memory 820 for further processing.
The bluetooth module 870 is used for exchanging information with other bluetooth devices having a bluetooth module through a bluetooth protocol. For example, the smart product may establish a bluetooth connection with a wearable electronic device (e.g., a smart watch) that also has a bluetooth module through the bluetooth module 870, thereby performing data interaction.
The processor 880 is a control center of the smart product, connects various parts of the entire terminal using various interfaces and lines, and performs various functions of the smart product and processes data by running or executing software programs stored in the memory 820 and calling data stored in the memory 820. In some embodiments, processor 880 may include one or more processing units; the processor 880 may also integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., and a baseband processor that primarily handles wireless communications. It will be appreciated that the baseband processor described above may not be integrated into the processor 880. Processor 880 in the present application may run an operating system, applications, user interface displays and touch responses, as well as content extension methods and/or question answering methods of embodiments of the present application. In addition, the processor 880 is coupled to the display unit 830.
In some possible implementations, aspects of the content extension method and/or the question answering method provided herein may also be implemented in the form of a program product comprising program code for causing a computer device to perform the steps of the content extension method and/or the question answering method according to various exemplary embodiments of the present application described herein above, when the program product is run on a computer device, e.g. the computer device may perform the steps as shown in fig. 2.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The program product of embodiments of the present application may employ a portable compact disc read only memory (CD-ROM) and include program code and may run on a computing device. However, the program product of the present application is not limited thereto, and in the embodiments of the present application, the readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with a command execution system, apparatus, or device.
The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with a command execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's equipment, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. Indeed, the features and functions of two or more of the elements described above may be embodied in one element in accordance with embodiments of the present application. Conversely, the features and functions of one unit described above may be further divided into a plurality of units to be embodied.
Furthermore, although the operations of the methods of the present application are depicted in the drawings in a particular order, this is not required to or suggested that these operations must be performed in this particular order or that all of the illustrated operations must be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program commands may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the commands executed by the processor of the computer or other programmable data processing apparatus produce means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program commands may also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the commands stored in the computer readable memory produce an article of manufacture including command means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various modifications and variations can be made in the present application without departing from the spirit or scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims and the equivalents thereof, the present application is intended to cover such modifications and variations.

Claims (16)

1. A content extension method applied to a dialogue system in an intelligent product, comprising:
acquiring a document uploaded by a user;
performing word vector conversion on the document to obtain a document vector corresponding to the document;
and storing the document vector into a pre-established vector database, determining an alternative vector with the similarity to the question vector being greater than a preset similarity threshold value from the vector database when the question is replied, replying to the question based on at least one determined alternative vector, wherein the question vector is obtained by carrying out word vector conversion on the question.
2. The method according to claim 1, wherein the method further comprises:
generating, using a large language model in the dialog system, extended content associated with the document, the extended content including at least one of: the method comprises the steps of abstracting the document, a plurality of document questions generated by asking the document, and a plurality of abstract questions generated by asking the abstract of the document;
Word vector conversion is carried out on the extended content, and an extended content vector corresponding to the extended content is obtained;
the extended content vector is stored in the vector database.
3. The method of claim 2, wherein the generating extended content associated with the document using a large language model in the dialog system comprises:
when the number of characters contained in the document is determined to be larger than a preset number threshold, segmenting the document into a plurality of document fragments;
if the extension content comprises the abstract of the document, generating multi-level abstracts corresponding to the plurality of document fragments by using the large language model;
if the extension content comprises a plurality of document questions generated by asking questions of the document, asking questions of each document fragment by using the large language model to generate the document questions corresponding to each document fragment;
if the extended content comprises a plurality of abstract questions generated by asking the abstract of the document, generating multi-level abstract corresponding to the plurality of document fragments by using the large language model, asking each abstract, and generating abstract questions corresponding to each abstract;
Wherein each level of the multi-level summaries comprises at least one summary, and each summary is generated based on at least one document fragment or at least one summary in the previous level.
4. The method according to claim 2, wherein the method further comprises:
acquiring meta information of the document;
generating meta information of the extended content based on the meta information of the document;
and storing the meta information of the document corresponding to the document vector and the meta information of the extended content corresponding to the extended content vector in the vector database.
5. The method of any of claims 2-4, wherein after the obtaining the user uploaded document, the method further comprises:
converting the document and the extension content into the same other languages respectively by using the large language model;
word vector conversion is respectively carried out on the converted document and the converted extension content, so as to obtain a document vector corresponding to the converted document and an extension content vector corresponding to the converted extension content;
and storing a document vector corresponding to the converted document and an extended content vector corresponding to the converted extended content in the vector database.
6. A method of question answering, comprising:
acquiring a problem proposed by a user;
performing word vector conversion on the problem to obtain a corresponding problem vector;
in a pre-established vector database, determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold, wherein at least one document vector is stored in the vector database, and the document vector is generated by performing word vector conversion on a document acquired by history;
when at least one candidate vector is determined, the question is replied to based on the candidate vector.
7. The method of claim 6, wherein in the vector database, further comprising: an extended content vector generated by word vector conversion of extended content generated based on a history-acquired document, the extended content comprising at least one of: the method comprises the steps of abstracting a document obtained by history, a plurality of document questions generated by asking the document obtained by history, and a plurality of abstract questions generated by asking the abstract;
the determining, in a pre-established vector database, an alternative vector having a similarity to the problem vector greater than a preset similarity threshold, includes:
And determining an alternative vector with the similarity to the problem vector being greater than a preset similarity threshold value from the document vector and the extended content vector included in the vector database.
8. The method of claim 7, wherein the replying to the question based on the candidate vector when determining at least one candidate vector comprises:
when the determined candidate vectors are multiple, selecting a preset number of candidate vectors from the multiple candidate vectors based on a preset strategy, and replying to the problem based on the preset number of candidate vectors.
9. The method of claim 8, wherein the preset policy comprises at least one of:
based on the similarity between each candidate vector and the problem vector, performing descending arrangement on the determined candidate vectors to obtain an arrangement result, and selecting a preset number of candidate vectors from the arrangement result;
selecting a first number of candidate vectors from candidate vectors of which the types are document vectors, and selecting a second number of candidate vectors from candidate vectors of which the types are expanded content vectors, wherein the sum of the first number and the second number is the preset number;
If the candidate vectors correspondingly store meta information, determining meta information corresponding to any candidate vector, determining a document set to which a document to which the candidate vector belongs based on the meta information, and selecting a preset number of candidate vectors from the candidate vectors generated in the document set.
10. The method according to any one of claims 7-9, wherein the vector database further comprises: storing meta information of the document corresponding to the document vector, and storing meta information of the extended content corresponding to the extended content vector;
the replying to the question based on the candidate vector comprises:
determining a source document or a source abstract to which the candidate vector belongs based on the meta information stored correspondingly by the candidate vector;
generating a prompt word based on the source document or the source abstract, and sending the prompt word to a large language model in the dialogue system so that the large language model replies to the problem based on the prompt word.
11. The method of claim 10, wherein the determining, based on the meta information corresponding to the candidate vector, a source document or a source digest to which the candidate vector belongs, comprises:
If the candidate vector is a document vector, determining a source document to which the document vector belongs based on meta information corresponding to the document vector;
if the candidate vector is a summary vector, determining a source summary to which the summary vector belongs based on meta information corresponding to the summary vector;
if the candidate vector is a document problem vector, determining a source document to which the document problem vector belongs based on meta information corresponding to the document problem vector;
and if the candidate vector is a summary problem vector, determining a source summary to which the summary problem vector belongs based on meta information corresponding to the summary problem vector.
12. A content expansion apparatus, comprising:
the acquisition unit is used for acquiring the document uploaded by the user;
the processing unit is used for carrying out word vector conversion on the document to obtain a document vector corresponding to the document;
and the storage unit is used for storing the document vector into a pre-established vector database, determining an alternative vector with the similarity greater than a preset similarity threshold value with the problem vector from the vector database when the problem is replied, replying the problem based on at least one determined alternative vector, and carrying out word vector conversion on the problem.
13. A question answering apparatus, comprising:
an acquisition unit for acquiring a question posed by a user;
the first processing unit is used for carrying out word vector conversion on the problems to obtain corresponding problem vectors;
the second processing unit is used for determining an alternative vector with the similarity to the problem vector being larger than a preset similarity threshold in a pre-established vector database, wherein at least one document vector is stored in the vector database, and the document vector is generated by performing word vector conversion on a document acquired by history;
and the replying unit is used for replying to the problem based on the alternative vector when at least one alternative vector is determined.
14. A dialog system, comprising:
the first acquisition module is used for acquiring the document uploaded by the user;
the first processing module is used for carrying out word vector conversion on the document to obtain a document vector corresponding to the document;
the storage module is used for storing the document vector into a pre-established vector database;
the second acquisition module is used for acquiring the problem proposed by the user;
the second processing module is used for carrying out word vector conversion on the problem to obtain a corresponding problem vector, and determining an alternative vector with similarity greater than a preset similarity threshold value with the problem vector in a pre-established vector database;
And the replying module is used for replying to the problem based on the alternative vector when at least one alternative vector is determined.
15. An electronic device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which when executed by the processor, implement the method of any one of claims 1-11.
16. A computer readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the method of any of claims 1-11.
CN202311367948.6A 2023-10-20 2023-10-20 Content extension and question reply method, device, system, equipment and medium Pending CN117591637A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311367948.6A CN117591637A (en) 2023-10-20 2023-10-20 Content extension and question reply method, device, system, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311367948.6A CN117591637A (en) 2023-10-20 2023-10-20 Content extension and question reply method, device, system, equipment and medium

Publications (1)

Publication Number Publication Date
CN117591637A true CN117591637A (en) 2024-02-23

Family

ID=89914125

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311367948.6A Pending CN117591637A (en) 2023-10-20 2023-10-20 Content extension and question reply method, device, system, equipment and medium

Country Status (1)

Country Link
CN (1) CN117591637A (en)

Similar Documents

Publication Publication Date Title
US10521505B2 (en) Cognitive mediator for generating blockchain smart contracts
CN107111725B (en) Protecting private information in an input understanding system
KR20210037619A (en) Multimodal content processing method, apparatus, device and storage medium
CN111400504B (en) Method and device for identifying enterprise key people
US20200285636A1 (en) Context-sensitive cross-lingual searches
CN113868497A (en) Data classification method and device and storage medium
CN112163428A (en) Semantic tag acquisition method and device, node equipment and storage medium
JP7488871B2 (en) Dialogue recommendation method, device, electronic device, storage medium, and computer program
KR20210090576A (en) A method, an apparatus, an electronic device, a storage medium and a program for controlling quality
WO2021068493A1 (en) Method and apparatus for processing information
CN113468344B (en) Entity relationship extraction method and device, electronic equipment and computer readable medium
US20230028381A1 (en) Enterprise knowledge base system for community mediation
US11599711B2 (en) Automatic delineation and extraction of tabular data in portable document format using graph neural networks
CN113642635A (en) Model training method and device, electronic device and medium
CN115378890B (en) Information input method, device, storage medium and computer equipment
US11676599B2 (en) Operational command boundaries
CN116958852A (en) Video and text matching method and device, electronic equipment and storage medium
CN117591637A (en) Content extension and question reply method, device, system, equipment and medium
CN112308016B (en) Expression image acquisition method and device, electronic equipment and storage medium
US20220122038A1 (en) Process Version Control for Business Process Management
US11303683B2 (en) Methods and systems for managing distribution of online content based on content maturity
CN114970494A (en) Comment generation method and device, electronic equipment and storage medium
CN115203194A (en) Metadata information generation method, related device, equipment and storage medium
CN117591638A (en) Question reply intervention method, device, equipment and medium
CN116561735B (en) Mutual trust authentication method and system based on multiple authentication sources and electronic equipment

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