WO2022016995A1 - 问答库构建方法、装置、电子设备及存储介质 - Google Patents
问答库构建方法、装置、电子设备及存储介质 Download PDFInfo
- Publication number
- WO2022016995A1 WO2022016995A1 PCT/CN2021/096633 CN2021096633W WO2022016995A1 WO 2022016995 A1 WO2022016995 A1 WO 2022016995A1 CN 2021096633 W CN2021096633 W CN 2021096633W WO 2022016995 A1 WO2022016995 A1 WO 2022016995A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- vector
- question
- sentence
- particle
- preset
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
- G06F16/355—Creation or modification of classes or clusters
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
- G06F18/232—Non-hierarchical techniques
- G06F18/2321—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
- G06F18/23213—Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/237—Lexical tools
- G06F40/242—Dictionaries
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
Definitions
- the present application relates to the technical field of data processing, and in particular, to a method, apparatus, electronic device and storage medium for constructing a question and answer library.
- a question and answer library can be built to support the intelligent customer service system, but in practice, the inventor found that in order to improve the performance of the intelligent customer service system, it is necessary to collect a large number of question and answer sentences to build the question and answer library, and the question and answer library may need to be updated frequently.
- the amount of online data gradually increases, the types of questions are varied, and the forms of questions vary, and the construction efficiency of the question and answer library will slow down.
- a first aspect of the present application provides a method for constructing a question and answer library, the method comprising:
- sentence extraction is performed on the customer service dialogue sentence to obtain a question sentence
- a customer service question and answer library is constructed.
- a second aspect of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory for storing at least one computer-readable instruction, the processor for executing the at least one computer-readable instruction to Implement the following steps:
- sentence extraction is performed on the customer service dialogue sentence to obtain a question sentence
- a customer service question and answer library is constructed.
- a third aspect of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, implements the following steps:
- sentence extraction is performed on the customer service dialogue sentence to obtain a question sentence
- a customer service question and answer library is constructed.
- a fourth aspect of the present application provides an apparatus for constructing a question and answer library, the apparatus comprising:
- the acquisition module is used to acquire the customer service dialogue statement
- an extraction module configured to perform sentence extraction on the customer service dialogue sentences according to preset keywords to obtain question sentences
- a conversion module for performing vector conversion on the question statement to obtain a statement vector
- a clustering module configured to perform incremental clustering on the question sentences according to the preset particle vector and the sentence vector, so as to determine the category corresponding to the question sentences;
- the building module is configured to build a customer service Q&A library according to the question sentence and the category corresponding to the question sentence.
- the present application can collect question sentences, and quickly classify the question sentences by means of incremental clustering, which avoids repeated clustering of historical data, reduces the construction time of the customer service question and answer database, and saves money.
- System resources are improved, and the construction speed of the customer service Q&A library is improved.
- FIG. 1 is a flowchart of a preferred embodiment of a method for constructing a question and answer library disclosed in the present application.
- FIG. 2 is a functional block diagram of a preferred embodiment of an apparatus for constructing a question and answer library disclosed in the present application.
- FIG. 3 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the method for constructing a question and answer library of the present application.
- the question and answer library construction method of the embodiment of the present application is applied to an electronic device, and can also be applied to a hardware environment composed of an electronic device and a server connected to the electronic device through a network, and is jointly executed by the server and the electronic device.
- the network includes, but is not limited to: a wide area network, a metropolitan area network or a local area network.
- the server may refer to a computer system that can provide services to other devices (eg, electronic devices) in the network. If a personal computer can provide a file transfer protocol (File Transfer Protocol, referred to as FTP) service, it can also be called a server.
- FTP File Transfer Protocol
- a server refers to some high-performance computers that can provide services to the outside world through a network. Compared with ordinary personal computers, servers have higher requirements in terms of stability, security, and performance. , chipset, memory, disk system, network and other hardware are different from ordinary personal computers.
- the electronic device is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), field programmable gates Arrays (FPGA), digital processors (DSP), embedded devices, etc.
- the electronic equipment may also include network equipment and/or user equipment.
- the network device includes but is not limited to a single network device, a server group composed of multiple network devices, or a cloud composed of a large number of hosts or network devices based on cloud computing, wherein cloud computing is distributed computing A super virtual computer consisting of a group of loosely coupled sets of computers.
- the user equipment includes but is not limited to any electronic product that can interact with the user through a keyboard, a mouse, a remote control, a touchpad or a voice-activated device, for example, a personal computer, a tablet computer, a smart phone, a personal digital Assistant PDA etc.
- FIG. 1 is a flowchart of a preferred embodiment of a method for constructing a question and answer library disclosed in the present application. Wherein, according to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
- the executing subject of the question and answer library construction method may be an electronic device.
- the customer service dialogue statement may be obtained from user communication records stored in the customer service system.
- the method further includes:
- the mean clustering (KMeans), for a given sample set, according to the distance between samples, a preset number k is set, the sample set is divided into k clusters, and the clusters are The points within the cluster are connected as closely as possible, and the distance between the clusters is as large as possible.
- the number of clusters to be clustered is k
- the maximum number of iterations is N
- k samples can be randomly selected from the sample set D as the initial k centroid vectors.
- sentences with user IDs in the customer service dialogue sentences can be extracted, and sentences with preset words can be extracted, such as sentences with words such as "modify", "how” and "how”.
- performing vector conversion on the questioning sentence to obtain the sentence vector includes:
- a sentence vector of the question sentence is generated.
- different dictionaries can be used for word segmentation for sentences in different fields, and some keywords can be obtained. For example, after word segmentation of "I want to change my mobile phone number", words such as "modify” and "mobile phone number” can be obtained. .
- the conversion network can convert words into a set of vector representations, and the conversion network can be obtained by training with CBOW (continuous-bag-of-words).
- CBOW continuous-bag-of-words
- a pre-trained conversion network can be used to perform vector conversion on the multiple words to obtain corresponding word vectors. For example, "modification” is represented as [-0.124,-0.871,0.812,-1.290,...] after vector conversion. .
- the sentence vector of the question sentence may be a vector set composed of word vectors of these words.
- each particle in the preset particle vector corresponds to a different category, and the category is used to distinguish different types of question sentences, and the question sentence is analyzed according to the preset particle vector and the sentence vector. Incremental clustering is performed to determine the categories corresponding to the question sentences including:
- For each sentence vector determine the distance between the sentence vector and each particle in the preset particle vector
- the category corresponding to the question sentence is the target category.
- the distance includes Euclidean distance, or Manhattan distance, or cosine similarity distance.
- Euclidean distance For example: for the vector coordinates x(x 1 ,x 2 ,x 3 ,...,x n ) and y(y 1 ,y 2 ,y 3 ,...,y n ), the Euclidean distance between them is:
- clustering ie, the incremental clustering
- new data the sentence vector
- the distances of all particles, from all particles in the preset particle vector determine the particle with the smallest distance from the sentence vector as the target particle; obtain the target category corresponding to the target particle; judge the sentence vector and the Whether the distance of the target particle is less than a preset distance threshold; if the distance between the sentence vector and the target particle is less than a preset distance threshold, determine that the category corresponding to the question sentence is the target category.
- the method further includes:
- the sentence vector can be added to the cluster corresponding to the target particle, and the particle of this cluster can be recalculated to update the Particles of this cluster.
- performing incremental clustering on the question sentence according to the preset particle vector and the sentence vector to determine the category corresponding to the question sentence further includes:
- the sentence vector represents an isolated point in the multi-dimensional space of the cluster, and can be The sentence vector is regarded as a category alone, and the particle of this category is the sentence vector.
- the customer service Q&A database may be a database storing question sentences and answer sentences
- the target category may be used to indicate the same type of questions
- the answer sentences may be the same as for the same type of questions, for example: suppose The category is to modify the contact number, and the corresponding question sentences of this category can be "modify the contact number", “change the number”, “change the number”, “I want to change the mobile phone number”, “I want to change the contact information” and so on.
- the question sentences can be automatically classified to construct a customer service question and answer database, which improves the construction speed of the customer service question and answer database.
- the content of the question and answer library may also be stored in a node of a blockchain.
- this application can also be used in the fields of smart government affairs, smart medical care or smart education, thereby promoting the construction of smart cities. It can collect all kinds of problems in government affairs that people handle, such as what information needs to be prepared for a certain certificate; it can collect people's problems in medical consultation, such as what kind of medical treatment should a certain symptom correspond to; it can collect people's education information. Questions, such as how to deal with child cooling, etc. Building a question and answer library can quickly solve common problems in the fields of government affairs, medical care and education, thereby promoting the construction of smart cities.
- question sentences can be collected, and the question sentences can be quickly classified by means of incremental clustering, which avoids repeated clustering of historical data and reduces the construction of customer service Q&A database. Time and system resources are saved, and the construction speed of the customer service Q&A library is improved.
- FIG. 2 is a functional block diagram of a preferred embodiment of an apparatus for constructing a question and answer library disclosed in the present application.
- the question-and-answer library construction apparatus 20 can run in an electronic device.
- the question and answer library construction apparatus 20 may include a plurality of functional modules composed of program code segments.
- the program codes of each program segment in the question and answer library construction apparatus 20 may be stored in a memory and executed by at least one processor to execute some or all of the steps in the question and answer library construction method described in FIG. 1 .
- the question and answer library construction apparatus 20 may be divided into a plurality of functional modules according to the functions performed by the apparatus 20 .
- the functional modules may include: an acquisition module 201 , an extraction module 202 , a conversion module 203 , a clustering module 204 , and a construction module 205 .
- a module referred to in this application refers to a series of computer-readable instruction segments that can be executed by at least one processor and can perform fixed functions, and are stored in a memory.
- the obtaining module 201 is used to obtain the customer service dialogue sentences.
- the customer service dialogue statement may be obtained from user communication records stored in the customer service system.
- the extraction module 202 is configured to perform sentence extraction on the customer service dialogue sentences according to preset keywords to obtain question sentences.
- sentences with user IDs in the customer service dialogue sentences can be extracted, and sentences with preset words can be extracted, such as sentences with words such as "modify", "how” and "how”.
- the conversion module 203 is configured to perform vector conversion on the question sentence to obtain a sentence vector.
- the clustering module 204 is configured to perform incremental clustering on the question sentence according to the preset particle vector and the sentence vector, so as to determine the category corresponding to the question sentence.
- the building module 205 is configured to build a customer service question and answer library according to the question sentence and the category corresponding to the question sentence.
- the customer service Q&A database may be a database storing question sentences and answer sentences
- the target category may be used to indicate the same type of questions
- the answer sentences may be the same as for the same type of questions, for example: suppose The category is to modify the contact number, and the corresponding question sentences of this category can be "modify the contact number", “change the number”, “change the number”, “I want to change the mobile phone number”, “I want to change the contact information” and so on.
- the question sentences can be automatically classified to construct a customer service question and answer database, which improves the construction speed of the customer service question and answer database.
- the clustering module 204 performs incremental clustering on the question sentence according to the preset particle vector and the sentence vector, so as to determine the category corresponding to the question sentence.
- the method is as follows: :
- For each sentence vector determine the distance between the sentence vector and each particle in the preset particle vector
- the category corresponding to the question sentence is the target category.
- the distance includes Euclidean distance, or Manhattan distance, or cosine similarity distance.
- Euclidean distance For example: for the vector coordinates x(x 1 ,x 2 ,x 3 ,...,x n ) and y(y 1 ,y 2 ,y 3 ,...,y n ), the Euclidean distance between them is:
- clustering ie, the incremental clustering
- new data the sentence vector
- the distances of all particles, from all particles in the preset particle vector determine the particle with the smallest distance from the sentence vector as the target particle; obtain the target category corresponding to the target particle; judge the sentence vector and the Whether the distance of the target particle is less than a preset distance threshold; if the distance between the sentence vector and the target particle is less than a preset distance threshold, determine that the category corresponding to the question sentence is the target category.
- the clustering module 204 performs incremental clustering on the question sentence according to the preset particle vector and the sentence vector, so as to determine the category corresponding to the question sentence, further comprising: :
- the sentence vector represents an isolated point in the multi-dimensional space of the cluster, and can be The sentence vector is regarded as a category alone, and the particle of this category is the sentence vector.
- the question and answer library construction apparatus 20 may further include:
- the adding module is used for adding the sentence vector to the cluster corresponding to the target particle after the clustering module 204 determines that the category corresponding to the question sentence is the target category;
- a calculation module for recalculating the mass points of the cluster is recalculating the mass points of the cluster.
- the sentence vector can be added to the cluster corresponding to the target particle, and the particle of this cluster can be recalculated to update the Particles of this cluster.
- the question and answer library construction method further includes:
- the obtaining module 201 is also used to obtain historical question statements
- the conversion module 203 is further configured to perform vector conversion on the historical question statement to obtain a historical vector;
- the clustering module 204 is further configured to perform mean clustering on the historical vector to obtain the preset particle vector.
- the mean clustering (KMeans), for a given sample set, according to the distance between samples, a preset number k is set, the sample set is divided into k clusters, and the clusters are The points within the cluster are connected as closely as possible, and the distance between the clusters is as large as possible.
- the number of clusters to be clustered is k
- the maximum number of iterations is N
- k samples can be randomly selected from the sample set D as the initial k centroid vectors.
- the conversion module 203 performs vector conversion on the question sentence, and the method for obtaining the sentence vector is specifically:
- a sentence vector of the question sentence is generated.
- different dictionaries can be used for word segmentation for sentences in different fields, and some keywords can be obtained. For example, after word segmentation of "I want to change my mobile phone number", words such as "modify” and "mobile phone number” can be obtained. .
- the conversion network can convert words into a set of vector representations, and the conversion network can be obtained by training with CBOW (continuous-bag-of-words).
- CBOW continuous-bag-of-words
- a pre-trained conversion network can be used to perform vector conversion on the multiple words to obtain corresponding word vectors. For example, "modification” is represented as [-0.124,-0.871,0.812,-1.290,...] after vector conversion. .
- the sentence vector of the question sentence may be a vector set composed of word vectors of these words.
- the content of the question and answer library may also be stored in a node of a blockchain.
- this application can also be used in the fields of smart government affairs, smart medical care or smart education, thereby promoting the construction of smart cities. It can collect all kinds of problems in government affairs that people handle, such as what information needs to be prepared for a certain certificate; it can collect people's problems in medical consultation, such as what kind of medical treatment should a certain symptom correspond to; it can collect people's education information. Questions, such as how to deal with child cooling, etc. Building a question and answer library can quickly solve common problems in the fields of government affairs, medical care and education, thereby promoting the construction of smart cities.
- question sentences can be collected, and the question sentences can be quickly classified by means of incremental clustering, which avoids repeated clustering of historical data and reduces customer service questions and answers.
- the construction time of the library saves system resources and improves the construction speed of the customer service Q&A library.
- FIG. 3 is a schematic structural diagram of an electronic device implementing a preferred embodiment of the method for constructing a question and answer library of the present application.
- the electronic device 3 includes a memory 31 , at least one processor 32 , a computer program 33 stored in the memory 31 and executable on the at least one processor 32 , and at least one communication bus 34 .
- FIG. 3 is only an example of the electronic device 3, and does not constitute a limitation on the electronic device 3, and may include more or less components than those shown, or combinations thereof Certain components, or different components, for example, the electronic device 3 may also include input and output devices, network access devices, and the like.
- the electronic device 3 also includes, but is not limited to, any electronic product that can interact with the user through a keyboard, a mouse, a remote control, a touchpad or a voice-activated device, for example, a personal computer, a tablet computer, a smart phone, Personal Digital Assistant (PDA), game console, Internet Protocol Television (IPTV), smart wearable devices, etc.
- the network where the electronic device 3 is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN) and the like.
- the at least one processor 32 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC) ), Field-Programmable Gate Array (FPGA) or other programmable logic devices, transistor logic devices, discrete hardware components, etc.
- the processor 32 can be a microprocessor or the processor 32 can also be any conventional processor, etc.
- the processor 32 is the control center of the electronic device 3, and uses various interfaces and lines to connect the entire electronic device 3 of each part.
- the memory 31 can be used to store the computer program 33 and/or modules/units, and the processor 32 executes or executes the computer programs and/or modules/units stored in the memory 31 and calls the computer programs and/or modules/units stored in the memory 31. 31 to realize various functions of the electronic device 3 .
- the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 31 and executed by the processor 32 to complete the present invention.
- the one or more modules/units may be a series of computer-readable instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 3 .
- the computer program may be divided into an acquisition module 201 , an extraction module 202 , a transformation module 203 , a clustering module 204 , and a building module 205 .
- the memory 31 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required for at least one function, and the like; Data and the like created according to the use of the electronic device 3 are stored.
- the memory 31 may include non-volatile memory and volatile memory, such as hard disk, internal memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, flash memory card (Flash Card), at least one disk storage device, flash memory device, random access memory, etc.
- the memory 31 in the electronic device 3 stores a plurality of computer-readable instructions to implement a method for constructing a question and answer library, and the processor 32 can execute the plurality of computer-readable instructions to implement:
- sentence extraction is performed on the customer service dialogue sentence to obtain a question sentence
- a customer service question and answer library is constructed.
- question sentences can be collected, and the question sentences can be quickly classified by means of incremental clustering, which avoids repeated clustering of historical data and reduces the number of questions in the customer service Q&A database.
- the construction time and system resources are saved, and the construction speed of the customer service Q&A library is improved.
- modules/units integrated in the electronic device 3 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium.
- the present application can implement all or part of the processes in the methods of the above embodiments, and can also be completed by instructing the relevant hardware through a computer program.
- the computer program can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, the steps of the foregoing method embodiments can be implemented.
- the computer program code may be in the form of source code, object code, executable file or some intermediate form, and so on.
- the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) .
- the computer-readable storage medium of the present application may be non-volatile or volatile.
- the computer-usable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required by at least one function, and the like; using the created data, etc.
- the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
- Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
- the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
- modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Health & Medical Sciences (AREA)
- Mathematical Physics (AREA)
- Databases & Information Systems (AREA)
- General Health & Medical Sciences (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Probability & Statistics with Applications (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Human Computer Interaction (AREA)
- Evolutionary Computation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请涉及数据处理技术领域,提出一种问答库构建方法、装置、电子设备及存储介质,所述方法包括:获取客服对话语句;根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;对所述提问语句进行向量转换,获得语句向量;根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。本申请能提高问答库的构建速度。此外,本申请涉及数据处理及人工智能技术领域,本申请还涉及区块链技术,问答库的内容可存储于区块链节点中,同时,本申请还可用于智慧政务、智慧医疗或智慧教育领域,从而推动智慧城市的建设。
Description
本申请要求于2020年7月23日提交中国专利局,申请号为202010718725.X申请名称为“问答库构建方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及数据处理技术领域,尤其涉及一种问答库构建方法、装置、电子设备及存储介质。
目前,可以构建问答库来支持智能客服系统,但是实践中发明人发现,为了提高智能客服系统的性能,需要搜集大量的问答语句来构建问答库,并可能需要经常更新问答库,随着用户量的增加,线上数据量逐渐增大,问题的种类五花八门,问题的形式变化不一等,问答库的构建效率会变慢。
因此,如何提高问答库的构建速度是一个亟需解决的问题。
发明内容
鉴于以上内容,有必要提供一种问答库构建方法、装置、电子设备及存储介质,能够提高问答库的构建速度。
本申请的第一方面提供一种问答库构建方法,所述方法包括:
获取客服对话语句;
根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;
对所述提问语句进行向量转换,获得语句向量;
根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;
根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
本申请的第二方面提供一种电子设备,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:
获取客服对话语句;
根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;
对所述提问语句进行向量转换,获得语句向量;
根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;
根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
本申请的第三方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
获取客服对话语句;
根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;
对所述提问语句进行向量转换,获得语句向量;
根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;
根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
本申请的第四方面提供一种问答库构建装置,所述装置包括:
获取模块,用于获取客服对话语句;
提取模块,用于根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;
转换模块,用于对所述提问语句进行向量转换,获得语句向量;
聚类模块,用于根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;
构建模块,用于根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
由以上技术方案,本申请可以搜集提问语句,并通过增量聚类的方式将所述提问语句进行快速归类,避免了对历史数据的重复聚类,减少了客服问答库的构建时间并节约了系统资源,提高了客服问答库的构建速度。
图1是本申请公开的一种问答库构建方法的较佳实施例的流程图。
图2是本申请公开的一种问答库构建装置的较佳实施例的功能模块图。
图3是本申请实现问答库构建方法的较佳实施例的电子设备的结构示意图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
本申请实施例的问答库构建方法应用在电子设备中,也可以应用在电子设备和通过网络与所述电子设备进行连接的服务器所构成的硬件环境中,由服务器和电子设备共同执行。网络包括但不限于:广域网、城域网或局域网。
其中,服务器可以是指能对网络中其它设备(如电子设备)提供服务的计算机系统。如果一个个人电脑能够对外提供文件传输协议(File Transfer Protocol,简称FTP)服务,也可以叫服务器。从狭义范围上讲,服务器专指某些高性能计算机,能通过网络,对外提供服务,其相对于普通的个人电脑来说,稳定性、安全性、性能等方面都要求更高,因此在CPU、芯片组、内存、磁盘系统、网络等硬件和普通的个人电脑有所不同。
所述电子设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(ASIC)、现场可编程门阵列(FPGA)、数字处理器(DSP)、嵌入式设备等。所述电子设备还可包括网络设备和/或用户设备。其中,所述网络设备包括但不限于单个网络设备、多个网络设备组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络设备构成的云,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。所述用户设备包括但不限于任何一种可与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理PDA等。
请参见图1,图1是本申请公开的一种问答库构建方法的较佳实施例的流程图。其中,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。所述问答库构建方法的执行主体可以是电子设备。
S11、获取客服对话语句。
其中,所述客服对话语句可以从客服系统中存储的用户沟通记录中获取。
作为一种可选的实施方式,所述步骤S11之前,所述方法还包括:
获取历史提问语句;
对所述历史提问语句进行向量转换,获得历史向量;
对所述历史向量进行均值聚类,获得所述预设质点向量。
在该可选的实施方式中,所述均值聚类(KMeans),对于给定的样本集,按照样本之间的距离大小,预设一个数量k,将样本集划分为k个簇,让簇内的点尽量紧密的连在一起,而让簇间的距离尽量的大。假设输入的样本集(所述历史向量)为D={x
1,x
2,...x
m},聚类的簇的数量为k,最大迭代次数为N,最后输出的簇(所述预设质点向量)为C={C
1,C
2,...C
k}。可以先从样本集D中随机选择k个样本作为初始的k个质心向量,质心向量的集合为:{μ
1,μ
2,...μ
k},初始化后进行步骤a和步骤b;步骤a:对于i=1,2,...,m,计算样本x
i和各个质心向量μ
j(j=1,2,...k)的距离d
ij,计算公式为:
将样本加入与其距离最小的类别,假设类别为λ
i,聚类更新后的簇为C
λi=C
λi∪{x
i}。步骤b:对于j=1,2,...,k,对簇C
j中所有的样本点重新计算新的质心向量,计算公式为:
重复步骤a和步骤b直到所有的k个质心向量都没有发生变化,输出最终得到的簇为C={C
1,C
2,...C
k},即所述预设质点向量为C。
S12、根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句。
本申请实施例中,可以对所述客服对话语句中的具有用户标识的语句进行语句提取,可以提取具有预设词语的语句,比如带有“修改”“怎么”“如何”等词语的语句。
S13、对所述提问语句进行向量转换,获得语句向量。
具体的,所述对所述提问语句进行向量转换,获得语句向量包括:
对所述提问语句进行分词,获得多个词语;
通过预先训练好的转换网络,对所述多个词语进行向量转换,获得多个词语向量;
根据所述词语向量,生成所述提问语句的语句向量。
在该可选的实施方式中,可以针对不同领域的语句使用不同的词典进行分词,获得一些关键词,比如“我想改手机号”经过分词后,可以获得“修改”“手机号”等词语。其中,所述转换网络可以将词转换为一组向量表示,所述转换网络可以使用CBOW(continuous-bag-of-words,连续词袋)训练获得。可以使用预先训练好的转换网络,将所述多个词语进行向量转换,获得对应的词语向量,例如:“修改”经过向量转换后表示为[-0.124,-0.871,0.812,-1.290,…]。所述提问语句的语句向量可以是由这些词语的词语向量组合成的向量集合。
S14、根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别。
具体的,所述预设质点向量中的每个质点对应一个不同的类别,所述类别用于区分不同类型的提问语句,所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别包括:
针对每个所述语句向量,确定所述语句向量与所述预设质点向量中的每个质点的距离;
从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目 标质点;
获取所述目标质点对应的目标类别;
判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;
若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。
其中,所述距离包括欧式距离,或曼哈顿距离,或余弦相似距离。比如:对于向量坐标x(x
1,x
2,x
3,...,x
n)和y(y
1,y
2,y
3,...,y
n),两者的欧式距离为:
在该可选的实施方式中,可以在所述预设质点向量的基础上进行聚类(即所述增量聚类),计算新数据(所述语句向量)与所述预设质点向量中所有质点的距离,从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;获取所述目标质点对应的目标类别;判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。不需要对所有数据重新计算距离,节约了系统资源,提高了系统性能。
作为一种可选的实施方式,所述确定所述提问语句对应的类别为所述目标类别之后,所述方法还包括:
将所述语句向量添加至所述目标质点对应的簇;
重新计算所述簇的质点。
在该可选的实施方式中,确定所述提问语句对应的类别为所述目标类别之后,可以将所述语句向量添加至所述目标质点对应的簇中,并重新计算这个簇的质点,更新该簇的质点。
作为一种可选的实施方式,所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别还包括:
若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,创建新类别;
确定所述提问语句对应的类别为所述新类别。
在该可选的实施方式中,若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,则说明所述语句向量在聚类的多维空间中表示一个孤立的点,可以将所述语句向量单独看成一个类别,该类别的质点就是所述语句向量。
S15、根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
其中,所述客服问答库可以是一个存储有提问语句以及回答语句的数据库,所述目标类别可以是用来指示同一类别问题,对与同一类别问题,其回答语句可以是一样的,比如:假设类别为修改联系电话,该类别对应的提问语句可以为“修改联系电话”,“改号码了”,“换号了”,“我想改手机号码”,“我想更改联系方式”等。
本申请实施例中,可以将所述提问语句自动归类,来构建客服问答库,提高了客服问答库的构建速度。
需要强调的是,为进一步保证上述问答库的内容的私密和安全性,上述问答库的内容还可以存储于一区块链的节点中。
同时,本申请还可用于智慧政务、智慧医疗或智慧教育领域,从而推动智慧城市的建设。可搜集人们办理的各种政务中的问题,比如办理某个证件需要准备哪些资料;可搜集人们在医疗咨询上的问题,比如某种症状对应需要挂什么科看病;可搜集人们在教育上的问题,比如孩子叛逆需要怎么处理等。构建问答库,可以快速解决政务、医疗以及教育领域常见的问题,从而推动智慧城市的建设。
在图1所描述的方法流程中,可以搜集提问语句,并通过增量聚类的方式将所述提问语句进行快速归类,避免了对历史数据的重复聚类,减少了客服问答库的构建时间并节约了系统资源,提高了客服问答库的构建速度。
图2是本申请公开的一种问答库构建装置的较佳实施例的功能模块图。
请参见图2,所述问答库构建装置20可运行于电子设备中。所述问答库构建装置20可以包括多个由程序代码段所组成的功能模块。所述问答库构建装置20中的各个程序段的程序代码可以存储于存储器中,并由至少一个处理器所执行,以执行图1所描述的问答库构建方法中的部分或全部步骤。
本实施例中,所述问答库构建装置20根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:获取模块201、提取模块202、转换模块203、聚类模块204、及构建模块205。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机可读指令段,其存储在存储器中。
获取模块201,用于获取客服对话语句。
其中,所述客服对话语句可以从客服系统中存储的用户沟通记录中获取。
提取模块202,用于根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句。
本申请实施例中,可以对所述客服对话语句中的具有用户标识的语句进行语句提取,可以提取具有预设词语的语句,比如带有“修改”“怎么”“如何”等词语的语句。
转换模块203,用于对所述提问语句进行向量转换,获得语句向量。
聚类模块204,用于根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别。
构建模块205,用于根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
其中,所述客服问答库可以是一个存储有提问语句以及回答语句的数据库,所述目标类别可以是用来指示同一类别问题,对与同一类别问题,其回答语句可以是一样的,比如:假设类别为修改联系电话,该类别对应的提问语句可以为“修改联系电话”,“改号码了”,“换号了”,“我想改手机号码”,“我想更改联系方式”等。
本申请实施例中,可以将所述提问语句自动归类,来构建客服问答库,提高了客服问答库的构建速度。
作为一种可选的实施方式,所述聚类模块204根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别的方式具体为:
针对每个所述语句向量,确定所述语句向量与所述预设质点向量中的每个质点的距离;
从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;
获取所述目标质点对应的目标类别;
判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;
若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。
其中,所述距离包括欧式距离,或曼哈顿距离,或余弦相似距离。比如:对于向量坐标x(x
1,x
2,x
3,...,x
n)和y(y
1,y
2,y
3,...,y
n),两者的欧式距离为:
在该可选的实施方式中,可以在所述预设质点向量的基础上进行聚类(即所述增量 聚类),计算新数据(所述语句向量)与所述预设质点向量中所有质点的距离,从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;获取所述目标质点对应的目标类别;判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。不需要对所有数据重新计算距离,节约了系统资源,提高了系统性能。
作为一种可选的实施方式,所述聚类模块204根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别的方式还包括:
若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,创建新类别;
确定所述提问语句对应的类别为所述新类别。
在该可选的实施方式中,若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,则说明所述语句向量在聚类的多维空间中表示一个孤立的点,可以将所述语句向量单独看成一个类别,该类别的质点就是所述语句向量。
作为一种可选的实施方式,所述问答库构建装置20还可以包括:
添加模块,用于所述聚类模块204确定所述提问语句对应的类别为所述目标类别之后,将所述语句向量添加至所述目标质点对应的簇;
计算模块,用于重新计算所述簇的质点。
在该可选的实施方式中,确定所述提问语句对应的类别为所述目标类别之后,可以将所述语句向量添加至所述目标质点对应的簇中,并重新计算这个簇的质点,更新该簇的质点。
作为一种可选的实施方式,所述获取客服对话语句之前,所述问答库构建方法还包括:
所述获取模块201,还用于获取历史提问语句;
所述转换模块203,还用于对所述历史提问语句进行向量转换,获得历史向量;
所述聚类模块204,还用于对所述历史向量进行均值聚类,获得所述预设质点向量。
在该可选的实施方式中,所述均值聚类(KMeans),对于给定的样本集,按照样本之间的距离大小,预设一个数量k,将样本集划分为k个簇,让簇内的点尽量紧密的连在一起,而让簇间的距离尽量的大。假设输入的样本集(所述历史向量)为D={x
1,x
2,...x
m},聚类的簇的数量为k,最大迭代次数为N,最后输出的簇(所述预设质点向量)为C={C
1,C
2,...C
k}。可以先从样本集D中随机选择k个样本作为初始的k个质心向量,质心向量的集合为:{μ
1,μ
2,...μ
k},初始化后进行步骤a和步骤b;步骤a:对于i=1,2,...,m,计算样本x
i和各个质心向量μ
j(j=1,2,...k)的距离d
ij,计算公式为:
将样本加入与其距离最小的类别,假设类别为λ
i,聚类更新后的簇为C
λi=C
λi∪{x
i}。步骤b:对于j=1,2,...,k,对簇C
j中所有的样本点重新计算新的质心向量,计算公式为:
重复步骤a和步骤b直到所有的k个质心向量都没有发生变化,输出最终得到的簇为C={C
1,C
2,...C
k},即所述预设质点向量为C。
作为一种可选的实施方式,所述转换模块203对所述提问语句进行向量转换,获得语句向量的方式具体为:
对所述提问语句进行分词,获得多个词语;
通过预先训练好的转换网络,对所述多个词语进行向量转换,获得多个词语向量;
根据所述词语向量,生成所述提问语句的语句向量。
在该可选的实施方式中,可以针对不同领域的语句使用不同的词典进行分词,获得一些关键词,比如“我想改手机号”经过分词后,可以获得“修改”“手机号”等词语。其中,所述转换网络可以将词转换为一组向量表示,所述转换网络可以使用CBOW(continuous-bag-of-words,连续词袋)训练获得。可以使用预先训练好的转换网络,将所述多个词语进行向量转换,获得对应的词语向量,例如:“修改”经过向量转换后表示为[-0.124,-0.871,0.812,-1.290,…]。所述提问语句的语句向量可以是由这些词语的词语向量组合成的向量集合。
需要强调的是,为进一步保证上述问答库的内容的私密和安全性,上述问答库的内容还可以存储于一区块链的节点中。
同时,本申请还可用于智慧政务、智慧医疗或智慧教育领域,从而推动智慧城市的建设。可搜集人们办理的各种政务中的问题,比如办理某个证件需要准备哪些资料;可搜集人们在医疗咨询上的问题,比如某种症状对应需要挂什么科看病;可搜集人们在教育上的问题,比如孩子叛逆需要怎么处理等。构建问答库,可以快速解决政务、医疗以及教育领域常见的问题,从而推动智慧城市的建设。
在图2所描述的问答库构建装置20中,可以搜集提问语句,并通过增量聚类的方式将所述提问语句进行快速归类,避免了对历史数据的重复聚类,减少了客服问答库的构建时间并节约了系统资源,提高了客服问答库的构建速度。
如图3所示,图3是本申请实现问答库构建方法的较佳实施例的电子设备的结构示意图。所述电子设备3包括存储器31、至少一个处理器32、存储在所述存储器31中并可在所述至少一个处理器32上运行的计算机程序33及至少一条通讯总线34。
本领域技术人员可以理解,图3所示的示意图仅仅是所述电子设备3的示例,并不构成对所述电子设备3的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述电子设备3还可以包括输入输出设备、网络接入设备等。
所述电子设备3还包括但不限于任何一种可与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。所述电子设备3所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。
所述至少一个处理器32可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、分立硬件组件等。该处理器32可以是微处理器或者该处理器32也可以是任何常规的处理器等,所述处理器32是所述电子设备3的控制中心,利用各种接口和线路连接整个电子设备3的各个部分。
所述存储器31可用于存储所述计算机程序33和/或模块/单元,所述处理器32通过运行或执行存储在所述存储器31内的计算机程序和/或模块/单元,以及调用存储在存储器31内的数据,实现所述电子设备3的各种功能。
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器31中,并由所述处理器32执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机程序在所述电子设备3中的执行过程。例如,所述计算机程序可以被分割成获取模块201、提取模块202、转换模块203、聚类模块204、及构建模块205。
所述存储器31可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、 至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据电子设备3的使用所创建的数据等。此外,存储器31可以包括非易失性存储器和易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、随机存取存储器等。
结合图1,所述电子设备3中的所述存储器31存储多个计算机可读指令以实现一种问答库构建方法,所述处理器32可执行所述多个计算机可读指令从而实现:
获取客服对话语句;
根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;
对所述提问语句进行向量转换,获得语句向量;
根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;
根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
具体地,所述处理器32对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在图3所描述的电子设备3中,可以搜集提问语句,并通过增量聚类的方式将所述提问语句进行快速归类,避免了对历史数据的重复聚类,减少了客服问答库的构建时间并节约了系统资源,提高了客服问答库的构建速度。
所述电子设备3集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
本申请计算机可读存储介质可以是非易失性,也可以是易失性。
进一步地,所述计算机可用存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。说明书中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一、第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。
Claims (20)
- 一种问答库构建方法,其中,所述问答库构建方法包括:获取客服对话语句;根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;对所述提问语句进行向量转换,获得语句向量;根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
- 根据权利要求1所述的问答库构建方法,其中,所述预设质点向量中的每个质点对应一个不同的类别,所述类别用于区分不同类型的提问语句,所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别包括:针对每个所述语句向量,确定所述语句向量与所述预设质点向量中的每个质点的距离;从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;获取所述目标质点对应的目标类别;判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。
- 根据权利要求2所述的问答库构建方法,其中,所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别还包括:若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,创建新类别;确定所述提问语句对应的类别为所述新类别。
- 根据权利要求2所述的问答库构建方法,其中,所述确定所述提问语句对应的类别为所述目标类别之后,所述问答库构建方法还包括:将所述语句向量添加至所述目标质点对应的簇;重新计算所述簇的质点。
- 根据权利要求1至4中任一项所述的问答库构建方法,其中,所述获取客服对话语句之前,所述问答库构建方法还包括:获取历史提问语句;对所述历史提问语句进行向量转换,获得历史向量;对所述历史向量进行均值聚类,获得所述预设质点向量。
- 根据权利要求1至4中任一项所述的问答库构建方法,其中,所述对所述提问语句进行向量转换,获得语句向量包括:对所述提问语句进行分词,获得多个词语;通过预先训练好的转换网络,对所述多个词语进行向量转换,获得多个词语向量;根据所述词语向量,生成所述提问语句的语句向量。
- 根据权利要求1至4中任一项所述的问答库构建方法,其中,所述距离包括欧式距离,或曼哈顿距离,或余弦相似距离。
- 一种电子设备,其中,所述电子设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:获取客服对话语句;根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;对所述提问语句进行向量转换,获得语句向量;根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
- 根据权利要求8所述的电子设备,其中,所述预设质点向量中的每个质点对应一个不同的类别,所述类别用于区分不同类型的提问语句,所述处理器执行所述至少一个计算机可读指令以实现所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别时,具体包括:针对每个所述语句向量,确定所述语句向量与所述预设质点向量中的每个质点的距离;从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;获取所述目标质点对应的目标类别;判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。
- 根据权利要求9所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别时,具体还包括:若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,创建新类别;确定所述提问语句对应的类别为所述新类别。
- 根据权利要求9所述的电子设备,其中,所述确定所述提问语句对应的类别为所述目标类别之后,所述处理器执行所述至少一个计算机可读指令还用以实现以下步骤:将所述语句向量添加至所述目标质点对应的簇;重新计算所述簇的质点。
- 根据权利要求8至11中任一项所述的电子设备,其中,所述获取客服对话语句之前,所述处理器执行所述至少一个计算机可读指令还用以实现以下步骤:获取历史提问语句;对所述历史提问语句进行向量转换,获得历史向量;对所述历史向量进行均值聚类,获得所述预设质点向量。
- 根据权利要求8至11中任一项所述的电子设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述对所述提问语句进行向量转换,获得语句向量时,具体包括:对所述提问语句进行分词,获得多个词语;通过预先训练好的转换网络,对所述多个词语进行向量转换,获得多个词语向量;根据所述词语向量,生成所述提问语句的语句向量。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:获取客服对话语句;根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;对所述提问语句进行向量转换,获得语句向量;根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
- 根据权利要求14所述的存储介质,其中,所述预设质点向量中的每个质点对应一个不同的类别,所述类别用于区分不同类型的提问语句,所述至少一个计算机可读指 令被所述处理器执行以实现所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别时,具体包括:针对每个所述语句向量,确定所述语句向量与所述预设质点向量中的每个质点的距离;从所述预设质点向量的所有质点中,将与所述语句向量的距离最小的质点确定为目标质点;获取所述目标质点对应的目标类别;判断所述语句向量与所述目标质点的距离是否小于预设距离阈值;若所述语句向量与所述目标质点的距离小于预设距离阈值,确定所述提问语句对应的类别为所述目标类别。
- 根据权利要求15所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别时,具体还包括:若所述语句向量与所述目标质点的距离大于或等于预设距离阈值,创建新类别;确定所述提问语句对应的类别为所述新类别。
- 根据权利要求15所述的存储介质,其中,所述确定所述提问语句对应的类别为所述目标类别之后,所述至少一个计算机可读指令被处理器执行时还用以实现以下步骤:将所述语句向量添加至所述目标质点对应的簇;重新计算所述簇的质点。
- 根据权利要求14至17中任一项所述的存储介质,其中,所述获取客服对话语句之前,所述至少一个计算机可读指令被处理器执行时还用以实现以下步骤:获取历史提问语句;对所述历史提问语句进行向量转换,获得历史向量;对所述历史向量进行均值聚类,获得所述预设质点向量。
- 根据权利要求14至17中任一项所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述对所述提问语句进行向量转换,获得语句向量时,具体包括:对所述提问语句进行分词,获得多个词语;通过预先训练好的转换网络,对所述多个词语进行向量转换,获得多个词语向量;根据所述词语向量,生成所述提问语句的语句向量。
- 一种问答库构建装置,其中,所述问答库构建装置包括:获取模块,用于获取客服对话语句;提取模块,用于根据预设关键词,对所述客服对话语句进行语句提取,获得提问语句;转换模块,用于对所述提问语句进行向量转换,获得语句向量;聚类模块,用于根据预设质点向量以及所述语句向量,对所述提问语句进行增量聚类,以确定所述提问语句对应的类别;构建模块,用于根据所述提问语句以及所述提问语句对应的类别,构建客服问答库。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010718725.XA CN111858891A (zh) | 2020-07-23 | 2020-07-23 | 问答库构建方法、装置、电子设备及存储介质 |
| CN202010718725.X | 2020-07-23 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022016995A1 true WO2022016995A1 (zh) | 2022-01-27 |
Family
ID=72950451
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/096633 Ceased WO2022016995A1 (zh) | 2020-07-23 | 2021-05-28 | 问答库构建方法、装置、电子设备及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN111858891A (zh) |
| WO (1) | WO2022016995A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116431809A (zh) * | 2023-04-17 | 2023-07-14 | 达而观科技(北京)有限公司 | 基于银行客服场景下的文本标注方法、装置和存储介质 |
| CN117033588A (zh) * | 2023-08-07 | 2023-11-10 | 北京字跳网络技术有限公司 | 一种问题推荐方法、装置、计算机设备及存储介质 |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111858891A (zh) * | 2020-07-23 | 2020-10-30 | 平安科技(深圳)有限公司 | 问答库构建方法、装置、电子设备及存储介质 |
| CN112463943A (zh) * | 2020-12-11 | 2021-03-09 | 深圳市一号互联科技有限公司 | 基于聚类算法的新知识点发现的处理方法及其装置、电子设备及存储介质 |
| CN113010658A (zh) * | 2021-04-08 | 2021-06-22 | 深圳市一号互联科技有限公司 | 一种智能问答知识库构建方法、系统、终端以及存储介质 |
| CN113553409A (zh) * | 2021-06-29 | 2021-10-26 | 北京来也网络科技有限公司 | 结合rpa和ai的智能对话方法、装置及电子设备 |
| CN113886542A (zh) * | 2021-09-29 | 2022-01-04 | 深圳科卫机器人科技有限公司 | 问答意图识别方法、装置、计算机设备及存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106649868A (zh) * | 2016-12-30 | 2017-05-10 | 首都师范大学 | 问答匹配方法及装置 |
| CN109918498A (zh) * | 2019-01-16 | 2019-06-21 | 平安科技(深圳)有限公司 | 一种问题入库方法和装置 |
| CN110309377A (zh) * | 2018-03-22 | 2019-10-08 | 阿里巴巴集团控股有限公司 | 语义归一化、提问模式的生成、应答确定方法及装置 |
| CN111858891A (zh) * | 2020-07-23 | 2020-10-30 | 平安科技(深圳)有限公司 | 问答库构建方法、装置、电子设备及存储介质 |
Family Cites Families (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8930422B2 (en) * | 2012-06-04 | 2015-01-06 | Northrop Grumman Systems Corporation | Pipelined incremental clustering algorithm |
| CN107784105A (zh) * | 2017-10-26 | 2018-03-09 | 平安科技(深圳)有限公司 | 基于海量问题的知识库构建方法、电子装置及存储介质 |
| CN110555101A (zh) * | 2019-09-09 | 2019-12-10 | 浙江诺诺网络科技有限公司 | 一种客服知识库更新方法、装置、设备及存储介质 |
| CN110750629A (zh) * | 2019-09-18 | 2020-02-04 | 平安科技(深圳)有限公司 | 机器人对话生成方法、装置、可读存储介质及机器人 |
-
2020
- 2020-07-23 CN CN202010718725.XA patent/CN111858891A/zh active Pending
-
2021
- 2021-05-28 WO PCT/CN2021/096633 patent/WO2022016995A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106649868A (zh) * | 2016-12-30 | 2017-05-10 | 首都师范大学 | 问答匹配方法及装置 |
| CN110309377A (zh) * | 2018-03-22 | 2019-10-08 | 阿里巴巴集团控股有限公司 | 语义归一化、提问模式的生成、应答确定方法及装置 |
| CN109918498A (zh) * | 2019-01-16 | 2019-06-21 | 平安科技(深圳)有限公司 | 一种问题入库方法和装置 |
| CN111858891A (zh) * | 2020-07-23 | 2020-10-30 | 平安科技(深圳)有限公司 | 问答库构建方法、装置、电子设备及存储介质 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116431809A (zh) * | 2023-04-17 | 2023-07-14 | 达而观科技(北京)有限公司 | 基于银行客服场景下的文本标注方法、装置和存储介质 |
| CN117033588A (zh) * | 2023-08-07 | 2023-11-10 | 北京字跳网络技术有限公司 | 一种问题推荐方法、装置、计算机设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111858891A (zh) | 2020-10-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2022016995A1 (zh) | 问答库构建方法、装置、电子设备及存储介质 | |
| CN107704625B (zh) | 字段匹配方法和装置 | |
| WO2021212752A1 (zh) | 基于设备指标数据的异常检测方法、装置、设备及存储介质 | |
| US11238339B2 (en) | Predictive neural network with sentiment data | |
| WO2021174944A1 (zh) | 基于目标对象活跃度的消息推送方法及相关设备 | |
| WO2021159738A1 (zh) | 基于医学领域的数据推荐方法、设备、服务器及存储介质 | |
| JP2021093163A (ja) | ディープラーニングに基づく文書類似度測定モデルを利用した重複文書探知方法およびシステム | |
| CN112214515B (zh) | 数据自动匹配方法、装置、电子设备及存储介质 | |
| CN118467793B (zh) | 一种面向异质图的图匹配方法、设备及介质 | |
| WO2020186458A1 (zh) | 问题生成方法和装置、问诊系统、计算机可读存储介质 | |
| CN114385878A (zh) | 政务数据的可视化展示方法、装置及终端设备 | |
| CN114723652B (zh) | 细胞密度确定方法、装置、电子设备及存储介质 | |
| CN113254716B (zh) | 视频片段检索方法、装置、电子设备和可读存储介质 | |
| WO2021174923A1 (zh) | 概念词序列生成方法、装置、计算机设备及存储介质 | |
| CN116150185B (zh) | 基于人工智能的数据标准提取方法、装置、设备及介质 | |
| CN116402166B (zh) | 一种预测模型的训练方法、装置、电子设备及存储介质 | |
| CN116541499A (zh) | 语义相似度计算方法、装置、设备及存储介质 | |
| CN114840733A (zh) | 主数据识别方法、装置、设备及存储介质 | |
| CN115169360A (zh) | 基于人工智能的用户意图识别方法及相关设备 | |
| CN111222032B (zh) | 舆情分析方法及相关设备 | |
| CN114820409A (zh) | 图像异常检测方法、装置、电子设备及存储介质 | |
| CN114726851A (zh) | 区块运算方法、装置、电子设备及存储介质 | |
| CN116127377B (zh) | 群体分类方法、装置、设备及存储介质 | |
| TWI769661B (zh) | 圖像異常檢測方法、裝置、電腦裝置及儲存介質 | |
| CN112509640B (zh) | 基因本体项名称生成方法、装置及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21846067 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 21846067 Country of ref document: EP Kind code of ref document: A1 |

