WO2021051507A1 - Bot conversation generation method, device, readable storage medium, and bot - Google Patents

Bot conversation generation method, device, readable storage medium, and bot Download PDF

Info

Publication number
WO2021051507A1
WO2021051507A1 PCT/CN2019/116628 CN2019116628W WO2021051507A1 WO 2021051507 A1 WO2021051507 A1 WO 2021051507A1 CN 2019116628 W CN2019116628 W CN 2019116628W WO 2021051507 A1 WO2021051507 A1 WO 2021051507A1
Authority
WO
WIPO (PCT)
Prior art keywords
dialogue
preferred
sentence
dialogue sentence
word
Prior art date
Application number
PCT/CN2019/116628
Other languages
French (fr)
Chinese (zh)
Inventor
于凤英
王健宗
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021051507A1 publication Critical patent/WO2021051507A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems

Definitions

  • This application belongs to the field of computer technology, and in particular relates to a method and device for generating a robot dialogue, a computer non-volatile readable storage medium, and a robot.
  • dialogue robots are applied to more and more fields. These dialogue robots can communicate with users through voice or text, providing a basis for automated and intelligent user services.
  • conversations generated by the current robots often contain some uncomfortable sentences, and the user experience is poor.
  • the embodiments of the present application provide a method and device for generating a robot dialog, a computer non-volatile readable storage medium, and a robot, so as to solve the problem that some existing dialogs generated by current robots often contain some Problems with uncomfortable sentences and poor user experience.
  • the first aspect of the embodiments of the present application provides a method for generating a robot dialogue, which may include:
  • the preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  • the second aspect of the embodiments of the present application provides an apparatus for generating a robot dialogue, which may include:
  • the word segmentation processing module is configured to collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence respectively to obtain each word that composes the first dialogue sentence;
  • the input vector sequence construction module is used to query the word vector of each word composing the first dialogue sentence in a preset word vector database, and construct the word vector of each word composing the first dialogue sentence as input Vector sequence
  • the dialogue generation module is used to process the input vector sequence using a preset dialogue generation model to obtain each preferred dialogue sentence and the corresponding first output probability;
  • the fluency calculation module is used to calculate the fluency of each preferred dialogue sentence according to the first output probability
  • the sentence response module is used to determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
  • a third aspect of the embodiments of the present application provides a computer non-volatile readable storage medium, the computer non-volatile readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor When implementing the following steps:
  • the preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  • the fourth aspect of the embodiments of the present application provides a robot, including a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, and the processor executes the computer The following steps are implemented when reading instructions:
  • the preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  • the embodiment of the present application has the beneficial effect that: the embodiment of the present application first collects the first dialogue sentence, and performs word segmentation processing on the first dialogue sentence to obtain each of the first dialogue sentences. Then, in the preset word vector database, the word vectors of the words constituting the first dialogue sentence are respectively queried, and the word vectors of the words constituting the first dialogue sentence are constructed as an input vector sequence, and then, Use the preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability, and calculate the smoothness of each preferred dialogue sentence according to the first output probability. Finally, The preferred dialogue sentence with the highest smoothness is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence. In this way, only the most fluent dialogue sentences are output, and a large number of uncomfortable sentences are filtered out, making the entire dialogue process clearer and smoother, and greatly improving the user experience.
  • FIG. 1 is a flowchart of an embodiment of a method for generating a robot dialog in an embodiment of the application
  • Figure 2 is a schematic flow chart of dividing the dialogue corpus into DN corpus sub-bases according to the dialogue scene generated by the dialogue sentence;
  • Figure 3 is a schematic diagram of the correspondence between each corpus and each model
  • FIG. 4 is a structural diagram of an embodiment of a device for generating a robot dialog in an embodiment of the application
  • Fig. 5 is a schematic block diagram of a robot in an embodiment of the application.
  • an embodiment of a method for generating a robot dialogue in an embodiment of the present application may include:
  • Step S101 Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence, respectively, to obtain each word composing the first dialogue sentence.
  • the implementation subject of this application is a robot for dialogue with the user.
  • the first dialogue sentence is a dialogue sentence expressed by the user through text or voice.
  • the robot monitors the user's text input and voice input in real time, and when it detects a new text or voice input, it can collect it to form the first dialogue sentence. It should be noted that when the user enters in the form of text, the robot can directly collect these words to form the first dialogue sentence. When the user enters in the form of voice, the robot can perform the voice first. Convert to text, and then use the converted text to form the first dialogue sentence.
  • Word segmentation refers to dividing a dialogue sentence into individual words.
  • the sentence can be segmented according to a general dictionary to ensure that the separated words are all normal words. If the word is not in the dictionary, it will be separated. Single word. When both the forward and backward directions can be formed into words, such as "request for god", it will be divided according to the statistical word frequency. If the word frequency of "requirement” is high, the word “requirement/shen” is divided, and if the word frequency of "quest for god" is high, it is divided into “must” /Pray for God". After the word segmentation processing is performed on the first dialogue sentence, each word that composes the first dialogue sentence can be obtained.
  • Step S102 Query the word vectors of the words constituting the first dialogue sentence in a preset word vector database, and construct the word vectors of the words constituting the first dialogue sentence as an input vector sequence.
  • the word vector database is a database that records the correspondence between words and word vectors.
  • the word vector may be a corresponding word vector obtained by training the word according to the word2vec model. That is, the probability of occurrence of the word is expressed according to the context information of the word.
  • the training of word vectors is still based on the idea of word2vec. First, each word is represented as a 0-1 vector (one-hot) form, and then the word2vec model is trained with the word vector, and n-1 words are used to predict the nth word , The intermediate process obtained after the neural network model prediction is used as the word vector.
  • the one-hot vector of "celebration” is assumed to be [1,0,0,0,...,0] and the one-hot vector of "meeting” is [0,1,0,0,... ...,0], the one-hot vector for "smooth” is [0,0,1,0, whil,0], the vector for predicting "closing” [0,0,0,1,>,0],
  • the model is trained to generate the coefficient matrix W of the hidden layer.
  • the product of the one-hot vector of each word and the coefficient matrix is the word vector of the word.
  • the final form will be similar to "Celebrate [-0.28,0.34,-0.02, ......,0.92]" such a multi-dimensional vector.
  • the word vectors of the words composing the first dialog sentence can be constructed in the form of a sequence, that is, the input vector sequence.
  • Step S103 Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability.
  • the dialogue generation model may be selected from a preset model set.
  • the model set includes DN models, and each model corresponds to a dialogue scene.
  • These dialogue scenes include but are not limited to education, financial management, Parenting, news, etc. scenes.
  • a dialogue corpus including a large number of dialogue sentences can be established in advance, and then the dialogue corpus is divided into DN corpus sub-bases according to the dialogue scenes generated by the dialogue sentences. All correspond to a dialogue scene.
  • the dialogue corpus can be divided into an educational corpus, a financial management corpus, a parenting corpus, a news corpus, and so on.
  • Model 1 is a model corresponding to the dialogue scene of education, which is trained by using dialogue sentences in the educational corpus as a sample.
  • Model 2 is a model corresponding to the dialogue scene of financial management. Then it is obtained by using the dialogue sentences in the financial management corpus as the sample training, and so on.
  • the dialogue scene of the first dialogue sentence may be determined first, and then a model corresponding to the dialogue scene of the first dialogue sentence may be selected from a preset model set as the dialogue generation model.
  • the model selected in this way is more targeted, which can greatly improve the accuracy of the dialogue sentence generation.
  • the dialogue generation model may be an encoder-decoder (Encoder-Decoder) structure model, its input is a sequence, and the output is also a sequence.
  • the encoder transforms a variable-length sequence into For a fixed-length vector expression, the decoder (Decoder) converts this fixed-length vector into a variable-length target sequence.
  • multiple candidate dialogue sentences can be constructed in advance, wherein each candidate dialogue sentence corresponds to a permutation and combination of words in the dialogue corpus.
  • the output vector sequence of each candidate dialogue sentence can be constructed respectively.
  • the input vector sequence is denoted as: Denote any one of the output vector sequences as: Where Tx is the length of the input vector sequence, x 1 is the first vector in the input vector sequence, Is the last vector in the input vector sequence, and so on. Ty is the length of the output vector sequence, y 1 is the first vector in the output vector sequence, Is the last vector in the output vector sequence, and so on.
  • What the encoder receives at time t is the t-th vector in the input vector sequence and the hidden state of the encoder at time t-1, and the output is the hidden state of the encoder at time t, namely :
  • x t is the t-th vector in the input vector sequence
  • h t is the hidden state of the encoder at time t
  • RNN enc is the RNN network model used by the encoder.
  • the decoder at time t receives the t-1th vector in the output vector sequence and the hidden state of the decoder at time t-1, and outputs the hidden state of the decoder at time t ,which is:
  • y t is the t-th vector in the output vector sequence
  • st is the hidden state of the decoder at time t
  • RNN dec is the RNN network model used by the decoder.
  • the score between the hidden state of the encoder at each time and the hidden state of the decoder at each time can be calculated according to the following formula:
  • e ij is the score between the hidden state of the encoder at time j and the hidden state of the decoder at time i
  • score is a preset score calculation function, including but not limited to the commonly used dot function, general function and concat function.
  • exp is the natural exponential function
  • ⁇ ij is the weight corresponding to e ij.
  • the output probability of each candidate dialogue sentence (that is, the output probability of the corresponding output vector sequence) is calculated, and the first N candidate dialogue sentences with the largest output probability are selected as the preferred dialogue sentences, and N is greater than 2. Integer.
  • the output probability of each preferred dialogue sentence is the first output probability.
  • Step S104 Calculate the fluency of each preferred dialogue sentence according to the first output probability.
  • the output probability of each preferred dialogue sentence in the preset reference model can be calculated separately, that is, the second output probability.
  • the reference model may be a unigram model. In the unigram model, it is assumed that the words in the sentence are independently exchangeable, and the order information of the words is irrelevant. Under such a premise, the probability of each word in each preferred dialogue sentence appearing in the dialogue corpus can be separately counted.
  • a preferred corpus can be selected from the dialogue corpus, and the preferred corpus is the same as the The corpus sub-base corresponding to the dialogue scene of the first dialogue sentence is then separately counted for the probability of each word in each preferred dialogue sentence appearing in the preferred corpus sub-base. That is, the probability of each occurrence in the preferred corpus sub-base is used to replace the probability of respective occurrence in the entire corpus of the corpus.
  • the second output probability of each preferred dialogue sentence can be calculated separately according to the following formula:
  • m is the sequence number of each word
  • , w n,m is the mth word in the nth preferred dialogue sentence
  • p(w n,m ) is the nth preferred dialogue sentence
  • P u (S n ) is the second output probability of the n-th preferred dialogue sentence.
  • n is the serial number of each preferred dialogue sentence, 1 ⁇ n ⁇ N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence,
  • any kind of dialogue generation model is essentially based on the corpus training used in mass daily life. It is obtained that the greater the output probability of a sentence in the model, the more widely it is used in people’s daily life. Its use conforms to people’s language habits (that is, the higher the smoothness), and a sentence is in the model. The smaller the output probability in, it means that it is hardly used in people's daily life, and its use is not in line with people's language habits (that is, the fluency is lower).
  • the reason for removing the second output probability of the sentence in the unigram model is to avoid the influence of the probability of a single word in the dialogue corpus on the smoothness of the entire sentence. For example, the following two statements:
  • Step S105 Determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
  • the second dialogue sentence is a dialogue sentence expressed by the robot through text or voice. It should be noted that when the robot responds in the form of text, it can directly use the second dialogue sentence to respond. When the robot responds in the form of voice, the text-to-speech response can be performed first. Convert, and then respond with the converted voice.
  • the embodiment of the present application first collects the first dialogue sentence, and performs word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence, and then stores it in a preset word vector database Query the word vectors of the words composing the first dialog sentence respectively, and construct the word vectors of the words composing the first dialog sentence as an input vector sequence, and then use a preset dialog generation model to input the input vector.
  • the vector sequence is processed to obtain each preferred dialogue sentence and the corresponding first output probability, and the smoothness of each preferred dialogue sentence is calculated according to the first output probability.
  • the preferred dialogue sentence with the highest smoothness is determined as the second Dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence. In this way, only the most fluent dialogue sentences are output, and a large number of uncomfortable sentences are filtered out, making the entire dialogue process clearer and smoother, and greatly improving the user experience.
  • FIG. 4 shows a structural diagram of an embodiment of a device for generating a robot dialog provided by an embodiment of the present application.
  • an apparatus for generating a robot dialog may include:
  • the word segmentation processing module 401 is configured to collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence respectively to obtain each word constituting the first dialogue sentence;
  • the input vector sequence construction module 402 is used to query the word vector of each word composing the first dialogue sentence in a preset word vector database, and construct the word vector of each word composing the first dialogue sentence as Input vector sequence;
  • the dialogue generation module 403 is configured to process the input vector sequence using a preset dialogue generation model to obtain each preferred dialogue sentence and the corresponding first output probability;
  • the fluency calculation module 404 is configured to calculate the fluency of each preferred dialog sentence according to the first output probability
  • the sentence response module 405 is configured to determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
  • the compliance calculation module may include:
  • the output probability calculation sub-module is used to calculate the second output probability of each preferred dialogue sentence in the preset reference model
  • the fluency calculation sub-module is used to calculate the fluency of each preferred dialogue sentence according to the following formula:
  • n is the serial number of each preferred dialogue sentence, 1 ⁇ n ⁇ N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence,
  • the output probability calculation sub-module may include:
  • the probability statistics unit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue corpus
  • the output probability calculation unit is used to calculate the second output probability of each preferred dialogue sentence according to the following formula:
  • m is the sequence number of each word
  • , w n,m is the mth word in the nth preferred dialogue sentence
  • p(w n,m ) is the nth preferred dialogue sentence The probability that the m-th word in, respectively appears in the dialogue corpus.
  • the device for generating a robot dialogue may further include:
  • a dialogue scene determination module configured to determine the dialogue scene of the first dialogue sentence
  • the dialogue generation model selection module is used to select a model corresponding to the dialogue scene of the first dialogue sentence from a preset model set as the dialogue generation model.
  • the model set includes DN models, each of which is Corresponds to a dialogue scene.
  • the probability statistics unit may include:
  • the corpus division sub-unit is used to divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
  • the probability statistics subunit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preferred corpus sub-base.
  • Fig. 5 shows a schematic block diagram of a robot provided by an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.
  • the robot 5 may include: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50, such as executing the aforementioned robot dialogue generation Computer readable instructions for the method.
  • the processor 50 executes the computer-readable instructions 52
  • the steps in the above embodiments of the robot dialog generation method are implemented, for example, steps S101 to S105 shown in FIG. 1.
  • the processor 50 executes the computer-readable instructions 52
  • the functions of the modules/units in the foregoing device embodiments such as the functions of the modules 401 to 405 shown in FIG. 4, are implemented.
  • the computer-readable instructions 52 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 51 and executed by the processor 50, To complete this application.
  • the one or more modules/units may be a series of computer-readable instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 52 in the robot 5.
  • the processor 50 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 circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 51 may be an internal storage unit of the robot 5, such as a hard disk or a memory of the robot 5.
  • the memory 51 may also be an external storage device of the robot 5, such as a plug-in hard disk equipped on the robot 5, a smart memory card (Smart Media Card, SMC), or a Secure Digital (SD) card, Flash Card, etc. Further, the memory 51 may also include both an internal storage unit of the robot 5 and an external storage device.
  • the memory 51 is used to store the computer-readable instructions and other instructions and data required by the robot 5.
  • the memory 51 can also be used to temporarily store data that has been output or will be output.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

A bot conversation generation method, a device, a non-volatile computer readable storage medium, and a bot, pertaining to the technical field of computers. The method, the device, the non-volatile computer readable storage medium, and the bot comprise: acquiring a first conversation sentence, performing word segmentation on the first conversation sentence, and obtaining words composing the first conversation sentence; searching a word vector database for respective word vectors of the words composing the first conversation sentence, and constructing an input vector sequence using the word vectors of the words composing the first conversation sentence; processing the input vector sequence by using a conversation generation model, and obtaining preferable conversation sentences and corresponding first output probabilities; calculating, according to the first output probabilities, a smoothness level of each of the preferable conversation sentences; and determining a preferable conversation sentence having the highest smoothness level as a second conversation sentence, and responding to the first conversation sentence by using the second conversation sentence. The invention improves clarity and smoothness of a conversation process.

Description

一种机器人对话生成方法、装置、可读存储介质及机器人Method, device, readable storage medium and robot for generating robot dialogue
本申请要求于2019年9月18日提交中国专利局、申请号为201910880856.5、发明名称为“一种机器人对话生成方法、装置、可读存储介质及机器人”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on September 18, 2019, the application number is 201910880856.5, and the invention title is "a method, device, readable storage medium and robot for generating a robot dialogue", all of which The content is incorporated in this application by reference.
技术领域Technical field
本申请属于计算机技术领域,尤其涉及一种机器人对话生成方法、装置、计算机非易失性可读存储介质及机器人。This application belongs to the field of computer technology, and in particular relates to a method and device for generating a robot dialogue, a computer non-volatile readable storage medium, and a robot.
背景技术Background technique
随着科学技术的不断发展,对话机器人被应用到越来越多的领域中,这些对话机器人可以通过语音或者文字与用户进行对话交流,为自动化、智能化的用户服务提供了基础。但是,目前的机器人所生成的对话中,往往会夹带着一些不通顺的语句,用户体验较差。With the continuous development of science and technology, dialogue robots are applied to more and more fields. These dialogue robots can communicate with users through voice or text, providing a basis for automated and intelligent user services. However, the conversations generated by the current robots often contain some uncomfortable sentences, and the user experience is poor.
技术问题technical problem
有鉴于此,本申请实施例提供了一种机器人对话生成方法、装置、计算机非易失性可读存储介质及机器人,以解决现有的目前的机器人所生成的对话中,往往会夹带着一些不通顺的语句,用户体验较差的问题。In view of this, the embodiments of the present application provide a method and device for generating a robot dialog, a computer non-volatile readable storage medium, and a robot, so as to solve the problem that some existing dialogs generated by current robots often contain some Problems with uncomfortable sentences and poor user experience.
技术解决方案Technical solutions
本申请实施例的第一方面提供了一种机器人对话生成方法,可以包括:The first aspect of the embodiments of the present application provides a method for generating a robot dialogue, which may include:
采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
本申请实施例的第二方面提供了一种机器人对话生成装置,可以包括:The second aspect of the embodiments of the present application provides an apparatus for generating a robot dialogue, which may include:
分词处理模块,用于采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;The word segmentation processing module is configured to collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence respectively to obtain each word that composes the first dialogue sentence;
输入向量序列构造模块,用于在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量 构造为输入向量序列;The input vector sequence construction module is used to query the word vector of each word composing the first dialogue sentence in a preset word vector database, and construct the word vector of each word composing the first dialogue sentence as input Vector sequence
对话生成模块,用于使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;The dialogue generation module is used to process the input vector sequence using a preset dialogue generation model to obtain each preferred dialogue sentence and the corresponding first output probability;
通顺度计算模块,用于根据所述第一输出概率分别计算各个优选对话语句的通顺度;The fluency calculation module is used to calculate the fluency of each preferred dialogue sentence according to the first output probability;
语句回应模块,用于将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The sentence response module is used to determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
本申请实施例的第三方面提供了一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下步骤:A third aspect of the embodiments of the present application provides a computer non-volatile readable storage medium, the computer non-volatile readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor When implementing the following steps:
采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
本申请实施例的第四方面提供了一种机器人,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:The fourth aspect of the embodiments of the present application provides a robot, including a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, and the processor executes the computer The following steps are implemented when reading instructions:
采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
有益效果Beneficial effect
本申请实施例与现有技术相比存在的有益效果是:本申请实施例首先采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语,然后在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列,接着,使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率,并根据所述第一输出概率分别计算各个优选对话语句的通顺度,最后,将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。通过这样的方式,仅输出通顺度最高的对话语句,过滤掉大量不通顺的语句,使得整个对话过程更加清晰顺畅,极大提高了用户的使用体验。Compared with the prior art, the embodiment of the present application has the beneficial effect that: the embodiment of the present application first collects the first dialogue sentence, and performs word segmentation processing on the first dialogue sentence to obtain each of the first dialogue sentences. Then, in the preset word vector database, the word vectors of the words constituting the first dialogue sentence are respectively queried, and the word vectors of the words constituting the first dialogue sentence are constructed as an input vector sequence, and then, Use the preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability, and calculate the smoothness of each preferred dialogue sentence according to the first output probability. Finally, The preferred dialogue sentence with the highest smoothness is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence. In this way, only the most fluent dialogue sentences are output, and a large number of uncomfortable sentences are filtered out, making the entire dialogue process clearer and smoother, and greatly improving the user experience.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only of the present application. For some embodiments, those of ordinary skill in the art can obtain other drawings based on these drawings without creative labor.
图1为本申请实施例中一种机器人对话生成方法的一个实施例流程图;FIG. 1 is a flowchart of an embodiment of a method for generating a robot dialog in an embodiment of the application;
图2为按照对话语句所产生的对话场景将对话语料库划分为DN个语料子库的示意流程图;Figure 2 is a schematic flow chart of dividing the dialogue corpus into DN corpus sub-bases according to the dialogue scene generated by the dialogue sentence;
图3为各个语料子库与各个模型之间的对应关系示意图;Figure 3 is a schematic diagram of the correspondence between each corpus and each model;
图4为本申请实施例中一种机器人对话生成装置的一个实施例结构图;FIG. 4 is a structural diagram of an embodiment of a device for generating a robot dialog in an embodiment of the application;
图5为本申请实施例中一种机器人的示意框图。Fig. 5 is a schematic block diagram of a robot in an embodiment of the application.
本发明的实施方式Embodiments of the present invention
为使得本申请的发明目的、特征、优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本申请一部分实施例,而非全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purposes, features, and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the following The described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
请参阅图1,本申请实施例中一种机器人对话生成方法的一个实施例可以包括:Referring to FIG. 1, an embodiment of a method for generating a robot dialogue in an embodiment of the present application may include:
步骤S101、采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语。Step S101: Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence, respectively, to obtain each word composing the first dialogue sentence.
本申请的实施主体为用于与用户进行对话的机器人。所述第一对话语句为用户通过文字或语音表达出的对话语句。所述机器人实时对用户的文字输入及语音输入进行 监测,当监测到有新的文字或语音输入时,即可对其进行采集,形成所述第一对话语句。需要注意的是,当用户是通过文字的形式进行输入时,所述机器人可以直接采集这些文字形成所述第一对话语句,当用户是通过语音的形式进行输入时,所述机器人可以先进行语音到文字的转换,然后使用转换得到的文字形成所述第一对话语句。The implementation subject of this application is a robot for dialogue with the user. The first dialogue sentence is a dialogue sentence expressed by the user through text or voice. The robot monitors the user's text input and voice input in real time, and when it detects a new text or voice input, it can collect it to form the first dialogue sentence. It should be noted that when the user enters in the form of text, the robot can directly collect these words to form the first dialogue sentence. When the user enters in the form of voice, the robot can perform the voice first. Convert to text, and then use the converted text to form the first dialogue sentence.
分词处理是指将一个对话语句切分成一个一个单独的词语,在本实施例中,可以根据通用词典对语句进行切分,保证分出的词语都是正常词汇,如词语不在词典内则分出单字。当前后方向都可以成词时,例如“要求神”,会根据统计词频的大小划分,如“要求”词频高则分出“要求/神”,如“求神”词频高则分出“要/求神”。在对所述第一对话语句分别进行分词处理之后,即可得到组成所述第一对话语句的各个词语。Word segmentation refers to dividing a dialogue sentence into individual words. In this embodiment, the sentence can be segmented according to a general dictionary to ensure that the separated words are all normal words. If the word is not in the dictionary, it will be separated. Single word. When both the forward and backward directions can be formed into words, such as "request for god", it will be divided according to the statistical word frequency. If the word frequency of "requirement" is high, the word "requirement/shen" is divided, and if the word frequency of "quest for god" is high, it is divided into "must" /Pray for God". After the word segmentation processing is performed on the first dialogue sentence, each word that composes the first dialogue sentence can be obtained.
步骤S102、在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列。Step S102: Query the word vectors of the words constituting the first dialogue sentence in a preset word vector database, and construct the word vectors of the words constituting the first dialogue sentence as an input vector sequence.
所述词语向量数据库为记录词语与词语向量之间的对应关系的数据库。所述词语向量可以是根据word2vec模型训练词语所得到对应的词语向量。即根据词语的上下文信息来表示该词出现的概率。词语向量的训练依然按照word2vec的思想,先将每个词表示成一个0-1向量(one-hot)形式,再用词语向量进行word2vec模型训练,用n-1个词来预测第n个词,神经网络模型预测后得到的中间过程作为词语向量。具体地,如“庆祝”的one-hot向量假设定为[1,0,0,0,……,0],“大会”的one-hot向量为[0,1,0,0,……,0],“顺利”的one-hot向量为[0,0,1,0,……,0],预测“闭幕”的向量[0,0,0,1,……,0],模型经过训练会生成隐藏层的系数矩阵W,每个词的one-hot向量和系数矩阵的乘积为该词的词语向量,最后的形式将是类似于“庆祝[-0.28,0.34,-0.02,…...,0.92]”这样的一个多维向量。在分别查询得到组成所述第一对话语句的各个词语的词语向量之后,即可以将组成所述第一对话语句的各个词语的词语向量构造为序列的形式,也即所述输入向量序列。The word vector database is a database that records the correspondence between words and word vectors. The word vector may be a corresponding word vector obtained by training the word according to the word2vec model. That is, the probability of occurrence of the word is expressed according to the context information of the word. The training of word vectors is still based on the idea of word2vec. First, each word is represented as a 0-1 vector (one-hot) form, and then the word2vec model is trained with the word vector, and n-1 words are used to predict the nth word , The intermediate process obtained after the neural network model prediction is used as the word vector. Specifically, for example, the one-hot vector of "celebration" is assumed to be [1,0,0,0,...,0], and the one-hot vector of "meeting" is [0,1,0,0,... …,0], the one-hot vector for "smooth" is [0,0,1,0,……,0], the vector for predicting "closing" [0,0,0,1,……,0], The model is trained to generate the coefficient matrix W of the hidden layer. The product of the one-hot vector of each word and the coefficient matrix is the word vector of the word. The final form will be similar to "Celebrate [-0.28,0.34,-0.02, …...,0.92]" such a multi-dimensional vector. After the word vectors of the words composing the first dialog sentence are obtained by respectively querying, the word vectors of the words composing the first dialog sentence can be constructed in the form of a sequence, that is, the input vector sequence.
步骤S103、使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率。Step S103: Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability.
所述对话生成模型可以是从预设的模型集合中选取得到的,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景,这些对话场景包括但不限于教育、理财、育儿、新闻等等场景。The dialogue generation model may be selected from a preset model set. The model set includes DN models, and each model corresponds to a dialogue scene. These dialogue scenes include but are not limited to education, financial management, Parenting, news, etc. scenes.
在本实施例中,可以预先建立起一个包括海量的对话语句的对话语料库,然后,按照对话语句所产生的对话场景将所述对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景。例如,如图2所示,可以将所述对话语料库划分 为教育语料子库、理财语料子库、育儿语料子库、新闻语料子库等等。In this embodiment, a dialogue corpus including a large number of dialogue sentences can be established in advance, and then the dialogue corpus is divided into DN corpus sub-bases according to the dialogue scenes generated by the dialogue sentences. All correspond to a dialogue scene. For example, as shown in Figure 2, the dialogue corpus can be divided into an educational corpus, a financial management corpus, a parenting corpus, a news corpus, and so on.
由于同样的对话语句在不同的对话场景下可能会代表不同的含义,如果使用同一个模型来处理各种不同对话场景下所产生的对话语句,其准确率往往较低,因此,本实施例中针对每一种对话场景均设置有对应的模型,且该模型是使用对应的语料子库中的对话语句作为样本训练得到的。如图3所示,模型1为对应于教育这一对话场景的模型,则其是使用教育语料子库中的对话语句作为样本训练得到的,模型2为对应于理财这一对话场景的模型,则其是使用理财语料子库中的对话语句作为样本训练得到的,以此类推。Since the same dialogue sentence may represent different meanings in different dialogue scenarios, if the same model is used to process the dialogue sentences generated in various dialogue scenarios, the accuracy is often low. Therefore, in this embodiment A corresponding model is set for each dialogue scene, and the model is trained using dialogue sentences in the corresponding corpus as a sample. As shown in Figure 3, Model 1 is a model corresponding to the dialogue scene of education, which is trained by using dialogue sentences in the educational corpus as a sample. Model 2 is a model corresponding to the dialogue scene of financial management. Then it is obtained by using the dialogue sentences in the financial management corpus as the sample training, and so on.
在步骤S103之前,可以首先确定所述第一对话语句的对话场景,然后从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型。通过这种方式选取出来的模型更具针对性,可以极大提高对话语句生成的准确率。Before step S103, the dialogue scene of the first dialogue sentence may be determined first, and then a model corresponding to the dialogue scene of the first dialogue sentence may be selected from a preset model set as the dialogue generation model. The model selected in this way is more targeted, which can greatly improve the accuracy of the dialogue sentence generation.
所述对话生成模型可以是一个编码器-解码器(Encoder–Decoder)结构的模型,它的输入是一个序列,输出也是一个序列,所述编码器(Encoder)中将一个可变长度的序列变为固定长度的向量表达,所述解码器(Decoder)将这个固定长度的向量变成可变长度的目标的序列。The dialogue generation model may be an encoder-decoder (Encoder-Decoder) structure model, its input is a sequence, and the output is also a sequence. The encoder (Encoder) transforms a variable-length sequence into For a fixed-length vector expression, the decoder (Decoder) converts this fixed-length vector into a variable-length target sequence.
本实施例中可以预先构造多个候选对话语句,其中,每个候选对话语句均对应于所述对话语料库中的词语的一种排列组合方式。通过与上述步骤S101和步骤S102中类似的分词、词语向量查询等步骤,可以分别构造出各个候选对话语句的输出向量序列。In this embodiment, multiple candidate dialogue sentences can be constructed in advance, wherein each candidate dialogue sentence corresponds to a permutation and combination of words in the dialogue corpus. Through the steps of word segmentation and word vector query similar to those in step S101 and step S102, the output vector sequence of each candidate dialogue sentence can be constructed respectively.
此处将所述输入向量序列记为:
Figure PCTCN2019116628-appb-000001
将任意一个所述输出向量序列记为:
Figure PCTCN2019116628-appb-000002
其中,Tx为所述输入向量序列的长度,x 1为所述输入向量序列中的第一个向量,
Figure PCTCN2019116628-appb-000003
为所述输入向量序列中的最后一个向量,以此类推。Ty为所述输出向量序列的长度,y 1为所述输出向量序列中的第一个向量,
Figure PCTCN2019116628-appb-000004
为所述输出向量序列中的最后一个向量,以此类推。
Here, the input vector sequence is denoted as:
Figure PCTCN2019116628-appb-000001
Denote any one of the output vector sequences as:
Figure PCTCN2019116628-appb-000002
Where Tx is the length of the input vector sequence, x 1 is the first vector in the input vector sequence,
Figure PCTCN2019116628-appb-000003
Is the last vector in the input vector sequence, and so on. Ty is the length of the output vector sequence, y 1 is the first vector in the output vector sequence,
Figure PCTCN2019116628-appb-000004
Is the last vector in the output vector sequence, and so on.
所述编码器在时刻t接收的是所述输入向量序列中的第t个向量以及所述编码器在时刻t-1的隐藏状态,输出的是所述编码器在时刻t的隐藏状态,即:What the encoder receives at time t is the t-th vector in the input vector sequence and the hidden state of the encoder at time t-1, and the output is the hidden state of the encoder at time t, namely :
h t=RNN enc(x t,h t-1) h t =RNN enc (x t ,h t-1 )
其中,x t为所述输入向量序列中的第t个向量,h t为所述编码器在时刻t的隐藏状态,RNN enc为所述编码器所使用的RNN网络模型。 Where, x t is the t-th vector in the input vector sequence, h t is the hidden state of the encoder at time t, and RNN enc is the RNN network model used by the encoder.
所述解码器在时刻t接收的是所述输出向量序列中的第t-1个向量以及所述解码器在时刻t-1的隐藏状态,输出的是所述解码器在时刻t的隐藏状态,即:The decoder at time t receives the t-1th vector in the output vector sequence and the hidden state of the decoder at time t-1, and outputs the hidden state of the decoder at time t ,which is:
s t=RNN dec(y t-1,s t-1) s t =RNN dec (y t-1 ,s t-1 )
其中,y t为所述输出向量序列中的第t个向量,s t为所述解码器在时刻t的隐藏状态,RNN dec为所述解码器所使用的RNN网络模型。 Wherein, y t is the t-th vector in the output vector sequence, st is the hidden state of the decoder at time t, and RNN dec is the RNN network model used by the decoder.
在此基础上,可以根据下式计算所述编码器在每个时刻的隐藏状态和所述解码器在每个时刻的隐藏状态两两之间的分数:On this basis, the score between the hidden state of the encoder at each time and the hidden state of the decoder at each time can be calculated according to the following formula:
e ij=score(s i,h j) e ij = score(s i ,h j )
其中,e ij即为所述编码器在时刻j的隐藏状态和所述解码器在时刻i的隐藏状态之间的分数,score为预设的分数计算函数,包括但不限于常用的dot函数、general函数和concat函数。 Where e ij is the score between the hidden state of the encoder at time j and the hidden state of the decoder at time i, and score is a preset score calculation function, including but not limited to the commonly used dot function, general function and concat function.
然后,可以根据下式计算与e ij对应的权重: Then, the weight corresponding to e ij can be calculated according to the following formula:
Figure PCTCN2019116628-appb-000005
Figure PCTCN2019116628-appb-000005
其中,exp为自然指数函数,α ij即为与e ij对应的权重。 Among them, exp is the natural exponential function, and α ij is the weight corresponding to e ij.
接着,根据下式计算所述输出向量序列中的第t个向量的输出概率:Next, calculate the output probability of the t-th vector in the output vector sequence according to the following formula:
Figure PCTCN2019116628-appb-000006
Figure PCTCN2019116628-appb-000006
Figure PCTCN2019116628-appb-000007
Figure PCTCN2019116628-appb-000007
Figure PCTCN2019116628-appb-000008
Figure PCTCN2019116628-appb-000008
其中,c i
Figure PCTCN2019116628-appb-000009
为计算过程中的中间变量,tanh为双曲正切函数,softmax为归一化指数函数,W c和W s均为训练后得到的模型参数,p(y t|y <t,x)为p(y t|y 1,y 2,…,y t-1,x)的缩写,即在输入向量序列为x、输出向量序列中的前t-1个向量分别为y 1,y 2,…,y t-1的条件下,输出向量序列中的第t个向量为y t的概率。
Where c i and
Figure PCTCN2019116628-appb-000009
Is the intermediate variable in the calculation process, tanh is the hyperbolic tangent function, softmax is the normalized exponential function, W c and W s are the model parameters obtained after training, p(y t |y <t ,x) is p The abbreviation of (y t |y 1 ,y 2 ,…,y t-1 ,x), that is, the input vector sequence is x, and the first t-1 vectors in the output vector sequence are y 1 ,y 2 ,… , Under the condition of y t-1 , the probability that the t-th vector in the output vector sequence is y t.
最后,可以根据下式计算所述输出向量序列的输出概率:Finally, the output probability of the output vector sequence can be calculated according to the following formula:
Figure PCTCN2019116628-appb-000010
Figure PCTCN2019116628-appb-000010
按照以上方式,对各个候选对话语句的输出概率(也即对应的输出向量序列的输出概率)进行计算,从中选取输出概率最大的前N个候选对话语句作为所述优选对话语句,N为大于2的整数。各个优选对话语句的输出概率即为所述第一输出概率。According to the above method, the output probability of each candidate dialogue sentence (that is, the output probability of the corresponding output vector sequence) is calculated, and the first N candidate dialogue sentences with the largest output probability are selected as the preferred dialogue sentences, and N is greater than 2. Integer. The output probability of each preferred dialogue sentence is the first output probability.
步骤S104、根据所述第一输出概率分别计算各个优选对话语句的通顺度。Step S104: Calculate the fluency of each preferred dialogue sentence according to the first output probability.
首先,可以分别计算各个优选对话语句在预设的基准模型中的输出概率,也即所述第二输出概率。所述基准模型可以为unigram模型,在unigram模型中假设了语句中 的词语是独立可交换的,词语的顺序信息是无关紧要的。在这样的前提下,可以分别统计各个优选对话语句中的各个词语在所述对话语料库中分别出现的概率。First, the output probability of each preferred dialogue sentence in the preset reference model can be calculated separately, that is, the second output probability. The reference model may be a unigram model. In the unigram model, it is assumed that the words in the sentence are independently exchangeable, and the order information of the words is irrelevant. Under such a premise, the probability of each word in each preferred dialogue sentence appearing in the dialogue corpus can be separately counted.
在本实施例的一种具体实现中,在已经将所述对话语料库划分为DN个语料子库后,可以从所述对话语料库中选取优选语料子库,所述优选语料子库为与所述第一对话语句的对话场景对应的语料子库,然后分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。也即使用在所述优选语料子库中分别出现的概率来代替在整个所述语料子库中分别出现的概率。在此之后,可以根据下式分别计算各个优选对话语句的第二输出概率:In a specific implementation of this embodiment, after the dialogue corpus has been divided into DN corpora, a preferred corpus can be selected from the dialogue corpus, and the preferred corpus is the same as the The corpus sub-base corresponding to the dialogue scene of the first dialogue sentence is then separately counted for the probability of each word in each preferred dialogue sentence appearing in the preferred corpus sub-base. That is, the probability of each occurrence in the preferred corpus sub-base is used to replace the probability of respective occurrence in the entire corpus of the corpus. After that, the second output probability of each preferred dialogue sentence can be calculated separately according to the following formula:
Figure PCTCN2019116628-appb-000011
Figure PCTCN2019116628-appb-000011
其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率,P u(S n)为第n个优选对话语句的第二输出概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability of the m-th word in, respectively appearing in the dialogue corpus, P u (S n ) is the second output probability of the n-th preferred dialogue sentence.
然后,可以根据下式分别计算各个优选对话语句的通顺度:Then, the smoothness of each preferred dialogue sentence can be calculated according to the following formula:
Figure PCTCN2019116628-appb-000012
Figure PCTCN2019116628-appb-000012
其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is the smoothness of the nth preferred dialogue sentence.
该式的核心在于通过语句的输出概率来估算通顺度,这也是与语言使用的自然规律相吻合的:任何一种对话生成模型,其本质上都是基于对海量的日常生活所使用的语料训练得到的,一个语句在模型中的输出概率越大,说明其在人们日常生活中使用的也越广泛,它的使用是符合人们的语言习惯的(即通顺度较高),而一个语句在模型中的输出概率越小,说明其在人们日常生活中几乎不被使用,它的使用是不太符合人们的语言习惯的(即通顺度较低)。The core of this formula is to estimate the smoothness through the output probability of the sentence, which is also consistent with the natural law of language use: any kind of dialogue generation model is essentially based on the corpus training used in mass daily life. It is obtained that the greater the output probability of a sentence in the model, the more widely it is used in people’s daily life. Its use conforms to people’s language habits (that is, the higher the smoothness), and a sentence is in the model. The smaller the output probability in, it means that it is hardly used in people's daily life, and its use is not in line with people's language habits (that is, the fluency is lower).
而之所以去除语句在unigram模型中的第二输出概率,是要避免单一词语在所述对话语料库中出现的概率的大小对整个语句的通顺度造成的影响。比如如下两个语句:The reason for removing the second output probability of the sentence in the unigram model is to avoid the influence of the probability of a single word in the dialogue corpus on the smoothness of the entire sentence. For example, the following two statements:
语句1:“我来自于中国”Statement 1: "I come from China"
语句2:“我来自于土库曼斯坦”Statement 2: "I am from Turkmenistan"
这两个语句的长度相同,“中国”在所述对话语料库中出现的概率大于“土库曼 斯坦”,那么语句1比语句2的输出概率更大。但是实际上,这两个语句的通顺度是一样的,去除所述第二输出概率可以有效的避免这样的问题。These two sentences have the same length, and the probability of "China" appearing in the dialogue corpus is greater than that of "Turkmenistan", then sentence 1 has a greater output probability than sentence 2. But in fact, the smoothness of these two sentences is the same, and removing the second output probability can effectively avoid such problems.
步骤S105、将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。Step S105: Determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
所述第二对话语句为所述机器人通过文字或语音表达出的对话语句。需要注意的是,当所述机器人是通过文字的形式进行回应时,可以直接使用所述第二对话语句进行回应,当所述机器人是通过语音的形式进行回应时,可以先进行文字到语音的转换,然后使用转换得到的语音进行回应。The second dialogue sentence is a dialogue sentence expressed by the robot through text or voice. It should be noted that when the robot responds in the form of text, it can directly use the second dialogue sentence to respond. When the robot responds in the form of voice, the text-to-speech response can be performed first. Convert, and then respond with the converted voice.
综上所述,本申请实施例首先采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语,然后在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列,接着,使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率,并根据所述第一输出概率分别计算各个优选对话语句的通顺度,最后,将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。通过这样的方式,仅输出通顺度最高的对话语句,过滤掉大量不通顺的语句,使得整个对话过程更加清晰顺畅,极大提高了用户的使用体验。In summary, the embodiment of the present application first collects the first dialogue sentence, and performs word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence, and then stores it in a preset word vector database Query the word vectors of the words composing the first dialog sentence respectively, and construct the word vectors of the words composing the first dialog sentence as an input vector sequence, and then use a preset dialog generation model to input the input vector. The vector sequence is processed to obtain each preferred dialogue sentence and the corresponding first output probability, and the smoothness of each preferred dialogue sentence is calculated according to the first output probability. Finally, the preferred dialogue sentence with the highest smoothness is determined as the second Dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence. In this way, only the most fluent dialogue sentences are output, and a large number of uncomfortable sentences are filtered out, making the entire dialogue process clearer and smoother, and greatly improving the user experience.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence number of each step in the foregoing embodiment does not mean the order of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
对应于上文实施例所述的一种机器人对话生成方法,图4示出了本申请实施例提供的一种机器人对话生成装置的一个实施例结构图。Corresponding to the method for generating a robot dialog described in the above embodiment, FIG. 4 shows a structural diagram of an embodiment of a device for generating a robot dialog provided by an embodiment of the present application.
本实施例中,一种机器人对话生成装置可以包括:In this embodiment, an apparatus for generating a robot dialog may include:
分词处理模块401,用于采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;The word segmentation processing module 401 is configured to collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence respectively to obtain each word constituting the first dialogue sentence;
输入向量序列构造模块402,用于在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;The input vector sequence construction module 402 is used to query the word vector of each word composing the first dialogue sentence in a preset word vector database, and construct the word vector of each word composing the first dialogue sentence as Input vector sequence;
对话生成模块403,用于使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;The dialogue generation module 403 is configured to process the input vector sequence using a preset dialogue generation model to obtain each preferred dialogue sentence and the corresponding first output probability;
通顺度计算模块404,用于根据所述第一输出概率分别计算各个优选对话语句的通顺度;The fluency calculation module 404 is configured to calculate the fluency of each preferred dialog sentence according to the first output probability;
语句回应模块405,用于将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The sentence response module 405 is configured to determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
进一步地,所述通顺度计算模块可以包括:Further, the compliance calculation module may include:
输出概率计算子模块,用于分别计算各个优选对话语句在预设的基准模型中的第二输出概率;The output probability calculation sub-module is used to calculate the second output probability of each preferred dialogue sentence in the preset reference model;
通顺度计算子模块,用于根据下式分别计算各个优选对话语句的通顺度:The fluency calculation sub-module is used to calculate the fluency of each preferred dialogue sentence according to the following formula:
Figure PCTCN2019116628-appb-000013
Figure PCTCN2019116628-appb-000013
其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,P u(S n)为第n个优选对话语句的第二输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, P u (S n ) is the second output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is The smoothness of the nth preferred dialogue sentence.
进一步地,所述输出概率计算子模块可以包括:Further, the output probability calculation sub-module may include:
概率统计单元,用于分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率;The probability statistics unit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue corpus;
输出概率计算单元,用于根据下式分别计算各个优选对话语句的第二输出概率:The output probability calculation unit is used to calculate the second output probability of each preferred dialogue sentence according to the following formula:
Figure PCTCN2019116628-appb-000014
Figure PCTCN2019116628-appb-000014
其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability that the m-th word in, respectively appears in the dialogue corpus.
进一步地,所述机器人对话生成装置还可以包括:Further, the device for generating a robot dialogue may further include:
对话场景确定模块,用于确定所述第一对话语句的对话场景;A dialogue scene determination module, configured to determine the dialogue scene of the first dialogue sentence;
对话生成模型选取模块,用于从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景。The dialogue generation model selection module is used to select a model corresponding to the dialogue scene of the first dialogue sentence from a preset model set as the dialogue generation model. The model set includes DN models, each of which is Corresponds to a dialogue scene.
进一步地,所述概率统计单元可以包括:Further, the probability statistics unit may include:
语料子库划分子单元,用于将预设的对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景;The corpus division sub-unit is used to divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
优选语料子库选取子单元,用于从所述对话语料库中选取优选语料子库,所述优 选语料子库为与所述第一对话语句的对话场景对应的语料子库;A preferred corpus selection subunit for selecting a preferred corpus from the dialogue corpus, where the preferred corpus is a corpus corresponding to the dialogue scene of the first dialogue sentence;
概率统计子单元,用于分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。The probability statistics subunit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preferred corpus sub-base.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置,模块和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working processes of the above described devices, modules and units can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
图5示出了本申请实施例提供的一种机器人的示意框图,为了便于说明,仅示出了与本申请实施例相关的部分。Fig. 5 shows a schematic block diagram of a robot provided by an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.
在本实施例中,该机器人5可包括:处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机可读指令52,例如执行上述的机器人对话生成方法的计算机可读指令。所述处理器50执行所述计算机可读指令52时实现上述各个机器人对话生成方法实施例中的步骤,例如图1所示的步骤S101至S105。或者,所述处理器50执行所述计算机可读指令52时实现上述各装置实施例中各模块/单元的功能,例如图4所示模块401至405的功能。In this embodiment, the robot 5 may include: a processor 50, a memory 51, and computer-readable instructions 52 stored in the memory 51 and executable on the processor 50, such as executing the aforementioned robot dialogue generation Computer readable instructions for the method. When the processor 50 executes the computer-readable instructions 52, the steps in the above embodiments of the robot dialog generation method are implemented, for example, steps S101 to S105 shown in FIG. 1. Alternatively, when the processor 50 executes the computer-readable instructions 52, the functions of the modules/units in the foregoing device embodiments, such as the functions of the modules 401 to 405 shown in FIG. 4, are implemented.
示例性的,所述计算机可读指令52可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器51中,并由所述处理器50执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令52在所述机器人5中的执行过程。Exemplarily, the computer-readable instructions 52 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 51 and executed by the processor 50, To complete this application. The one or more modules/units may be a series of computer-readable instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer-readable instructions 52 in the robot 5.
所述处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其它通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其它可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 50 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 circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
所述存储器51可以是所述机器人5的内部存储单元,例如机器人5的硬盘或内存。所述存储器51也可以是所述机器人5的外部存储设备,例如所述机器人5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述机器人5的内部存储单元也包括外部存储设备。所述存储器51用于存储所述计算机可读指令以及所述机器人5所需的其它指令和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。The memory 51 may be an internal storage unit of the robot 5, such as a hard disk or a memory of the robot 5. The memory 51 may also be an external storage device of the robot 5, such as a plug-in hard disk equipped on the robot 5, a smart memory card (Smart Media Card, SMC), or a Secure Digital (SD) card, Flash Card, etc. Further, the memory 51 may also include both an internal storage unit of the robot 5 and an external storage device. The memory 51 is used to store the computer-readable instructions and other instructions and data required by the robot 5. The memory 51 can also be used to temporarily store data that has been output or will be output.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以 通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机非易失性可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。A person of ordinary skill in the art can understand that all or part of the processes in the method of the above-mentioned embodiments can be implemented by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a non-volatile computer. In a readable storage medium, when the computer-readable instructions are executed, they may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not a limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种机器人对话生成方法,其特征在于,包括:A method for generating a robot dialogue, which is characterized in that it comprises:
    采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
    在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
    使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
    根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
    将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  2. 根据权利要求1所述的机器人对话生成方法,其特征在于,所述根据所述第一输出概率分别计算各个优选对话语句的通顺度包括:The method for generating a robot dialogue according to claim 1, wherein the calculating the smoothness of each preferred dialogue sentence according to the first output probability comprises:
    分别计算各个优选对话语句在预设的基准模型中的第二输出概率;Respectively calculate the second output probability of each preferred dialogue sentence in the preset benchmark model;
    根据下式分别计算各个优选对话语句的通顺度:Calculate the fluency of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100001
    Figure PCTCN2019116628-appb-100001
    其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,P u(S n)为第n个优选对话语句的第二输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, P u (S n ) is the second output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is The smoothness of the nth preferred dialogue sentence.
  3. 根据权利要求2所述的机器人对话生成方法,其特征在于,所述分别计算各个优选对话语句在预设的基准模型中的第二输出概率包括:The method for generating a robot dialogue according to claim 2, wherein said calculating the second output probability of each preferred dialogue sentence in a preset reference model respectively comprises:
    分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率;Respectively count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue database;
    根据下式分别计算各个优选对话语句的第二输出概率:Calculate the second output probability of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100002
    Figure PCTCN2019116628-appb-100002
    其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability of the m-th word in, respectively appearing in the dialogue corpus.
  4. 根据权利要求3所述的机器人对话生成方法,其特征在于,在使用预设的对话生成模型对所述输入向量序列进行处理之前,还包括:The method for generating a robot dialog according to claim 3, characterized in that, before using a preset dialog generation model to process the input vector sequence, the method further comprises:
    确定所述第一对话语句的对话场景;Determine the dialogue scene of the first dialogue sentence;
    从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景。A model corresponding to the dialogue scene of the first dialogue sentence is selected from a preset model set as the dialogue generation model. The model set includes DN models, and each model corresponds to a dialogue scene.
  5. 根据权利要求4所述的机器人对话生成方法,其特征在于,所述分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率包括:The method for generating a robot dialogue according to claim 4, wherein said separately counting the probability of each word in each preferred dialogue sentence appearing in a preset dialogue corpus comprises:
    将预设的对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景;Divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
    从所述对话语料库中选取优选语料子库,所述优选语料子库为与所述第一对话语句的对话场景对应的语料子库;Selecting a preferred corpus sub-base from the dialogue corpus, where the preferred corpus sub-base is a corpus sub-base corresponding to the dialogue scene of the first dialogue sentence;
    分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。The probability of each word in each preferred dialogue sentence appearing in the preferred corpus is separately counted.
  6. 一种机器人对话生成装置,其特征在于,包括:A device for generating a robot dialogue, which is characterized in that it comprises:
    分词处理模块,用于采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;The word segmentation processing module is configured to collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence respectively to obtain each word that composes the first dialogue sentence;
    输入向量序列构造模块,用于在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;The input vector sequence construction module is used to query the word vector of each word composing the first dialogue sentence in a preset word vector database, and construct the word vector of each word composing the first dialogue sentence as input Vector sequence
    对话生成模块,用于使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;The dialogue generation module is used to process the input vector sequence using a preset dialogue generation model to obtain each preferred dialogue sentence and the corresponding first output probability;
    通顺度计算模块,用于根据所述第一输出概率分别计算各个优选对话语句的通顺度;The fluency calculation module is used to calculate the fluency of each preferred dialogue sentence according to the first output probability;
    语句回应模块,用于将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The sentence response module is used to determine the preferred dialogue sentence with the highest smoothness as the second dialogue sentence, and use the second dialogue sentence to respond to the first dialogue sentence.
  7. 根据权利要求6所述的机器人对话生成装置,其特征在于,所述通顺度计算模块包括:8. The robot dialog generating device according to claim 6, wherein the smoothness calculation module comprises:
    输出概率计算子模块,用于分别计算各个优选对话语句在预设的基准模型中的第二输出概率;The output probability calculation sub-module is used to calculate the second output probability of each preferred dialogue sentence in the preset reference model;
    通顺度计算子模块,用于根据下式分别计算各个优选对话语句的通顺度:The fluency calculation sub-module is used to calculate the fluency of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100003
    Figure PCTCN2019116628-appb-100003
    其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为 第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,P u(S n)为第n个优选对话语句的第二输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, P u (S n ) is the second output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is The smoothness of the nth preferred dialogue sentence.
  8. 根据权利要求7所述的机器人对话生成装置,其特征在于,所述输出概率计算子模块包括:8. The robot dialog generating device according to claim 7, wherein the output probability calculation sub-module comprises:
    概率统计单元,用于分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率;The probability statistics unit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue corpus;
    输出概率计算单元,用于根据下式分别计算各个优选对话语句的第二输出概率:The output probability calculation unit is used to calculate the second output probability of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100004
    Figure PCTCN2019116628-appb-100004
    其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability that the m-th word in, respectively appears in the dialogue corpus.
  9. 根据权利要求8所述的机器人对话生成装置,其特征在于,所述机器人对话生成装置还包括:8. The robot dialog generating device according to claim 8, wherein the robot dialog generating device further comprises:
    对话场景确定模块,用于确定所述第一对话语句的对话场景;A dialogue scene determination module, configured to determine the dialogue scene of the first dialogue sentence;
    对话生成模型选取模块,用于从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景。The dialogue generation model selection module is used to select a model corresponding to the dialogue scene of the first dialogue sentence from a preset model set as the dialogue generation model. The model set includes DN models, each of which is Corresponds to a dialogue scene.
  10. 根据权利要求9所述的机器人对话生成装置,其特征在于,所述概率统计单元包括:The robot dialogue generating device according to claim 9, wherein the probability statistics unit comprises:
    语料子库划分子单元,用于将预设的对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景;The corpus division sub-unit is used to divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
    优选语料子库选取子单元,用于从所述对话语料库中选取优选语料子库,所述优选语料子库为与所述第一对话语句的对话场景对应的语料子库;The preferred corpus selection subunit is used to select a preferred corpus from the dialogue corpus, where the preferred corpus is a corpus corresponding to the dialogue scene of the first dialogue sentence;
    概率统计子单元,用于分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。The probability statistics subunit is used to separately count the probability of each word in each preferred dialogue sentence appearing in the preferred corpus sub-base.
  11. 一种计算机非易失性可读存储介质,所述计算机非易失性可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:A computer non-volatile readable storage medium, the computer non-volatile readable storage medium storing computer readable instructions, wherein the computer readable instructions are executed by a processor to implement the following steps:
    采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第 一对话语句的各个词语;Collecting a first dialogue sentence, and performing word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
    在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
    使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
    根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
    将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  12. 根据权利要求11所述的计算机非易失性可读存储介质,其特征在于,所述根据所述第一输出概率分别计算各个优选对话语句的通顺度包括:11. The computer non-volatile readable storage medium according to claim 11, wherein said calculating the fluency of each preferred dialog sentence according to the first output probability comprises:
    分别计算各个优选对话语句在预设的基准模型中的第二输出概率;Respectively calculate the second output probability of each preferred dialogue sentence in the preset benchmark model;
    根据下式分别计算各个优选对话语句的通顺度:Calculate the fluency of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100005
    Figure PCTCN2019116628-appb-100005
    其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,P u(S n)为第n个优选对话语句的第二输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, P u (S n ) is the second output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is The smoothness of the nth preferred dialogue sentence.
  13. 根据权利要求12所述的计算机非易失性可读存储介质,其特征在于,所述分别计算各个优选对话语句在预设的基准模型中的第二输出概率包括:The computer non-volatile readable storage medium according to claim 12, wherein said separately calculating the second output probability of each preferred dialogue sentence in a preset reference model comprises:
    分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率;Respectively count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue database;
    根据下式分别计算各个优选对话语句的第二输出概率:Calculate the second output probability of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100006
    Figure PCTCN2019116628-appb-100006
    其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability of the m-th word in, respectively appearing in the dialogue corpus.
  14. 根据权利要求13所述的计算机非易失性可读存储介质,其特征在于,在使用预设的对话生成模型对所述输入向量序列进行处理之前,还包括:The computer non-volatile readable storage medium according to claim 13, wherein before using a preset dialogue generation model to process the input vector sequence, the method further comprises:
    确定所述第一对话语句的对话场景;Determine the dialogue scene of the first dialogue sentence;
    从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景。A model corresponding to the dialogue scene of the first dialogue sentence is selected from a preset model set as the dialogue generation model. The model set includes DN models, and each model corresponds to a dialogue scene.
  15. 根据权利要求14所述的计算机非易失性可读存储介质,其特征在于,所述分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率包括:The computer non-volatile readable storage medium according to claim 14, wherein said separately counting the probability of each word in each preferred dialogue sentence appearing in a preset dialogue corpus comprises:
    将预设的对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景;Divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
    从所述对话语料库中选取优选语料子库,所述优选语料子库为与所述第一对话语句的对话场景对应的语料子库;Selecting a preferred corpus sub-base from the dialogue corpus, where the preferred corpus sub-base is a corpus sub-base corresponding to the dialogue scene of the first dialogue sentence;
    分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。The probability of each word in each preferred dialogue sentence appearing in the preferred corpus is separately counted.
  16. 一种机器人,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A robot comprising a memory, a processor, and computer readable instructions stored in the memory and capable of running on the processor, wherein the processor executes the computer readable instructions to implement the following steps :
    采集第一对话语句,并对所述第一对话语句分别进行分词处理,得到组成所述第一对话语句的各个词语;Collect a first dialogue sentence, and perform word segmentation processing on the first dialogue sentence to obtain each word that composes the first dialogue sentence;
    在预设的词语向量数据库中分别查询组成所述第一对话语句的各个词语的词语向量,并将组成所述第一对话语句的各个词语的词语向量构造为输入向量序列;Query the word vector of each word constituting the first dialogue sentence in a preset word vector database, and construct the word vector of each word constituting the first dialogue sentence as an input vector sequence;
    使用预设的对话生成模型对所述输入向量序列进行处理,得到各个优选对话语句以及对应的第一输出概率;Use a preset dialogue generation model to process the input vector sequence to obtain each preferred dialogue sentence and the corresponding first output probability;
    根据所述第一输出概率分别计算各个优选对话语句的通顺度;Respectively calculating the fluency of each preferred dialogue sentence according to the first output probability;
    将通顺度最高的优选对话语句确定为第二对话语句,并使用所述第二对话语句对所述第一对话语句进行回应。The preferred dialogue sentence with the highest fluent degree is determined as the second dialogue sentence, and the second dialogue sentence is used to respond to the first dialogue sentence.
  17. 根据权利要求16所述的机器人,其特征在于,所述根据所述第一输出概率分别计算各个优选对话语句的通顺度包括:16. The robot according to claim 16, wherein the calculation of the smoothness of each preferred dialogue sentence according to the first output probability comprises:
    分别计算各个优选对话语句在预设的基准模型中的第二输出概率;Respectively calculate the second output probability of each preferred dialogue sentence in the preset benchmark model;
    根据下式分别计算各个优选对话语句的通顺度:Calculate the fluency of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100007
    Figure PCTCN2019116628-appb-100007
    其中,n为各个优选对话语句的序号,1≤n≤N,N为优选对话语句的数目,S n为第n个优选对话语句,|S n|为第n个优选对话语句的长度,P m(S n)为第n个优选对话语句的第一输出概率,P u(S n)为第n个优选对话语句的第二输出概率,ln为自然对数函数,SLOR(S n)为第n个优选对话语句的通顺度。 Among them, n is the serial number of each preferred dialogue sentence, 1≤n≤N, N is the number of preferred dialogue sentences, S n is the nth preferred dialogue sentence, |S n | is the length of the nth preferred dialogue sentence, P m (S n ) is the first output probability of the nth preferred dialogue sentence, P u (S n ) is the second output probability of the nth preferred dialogue sentence, ln is the natural logarithmic function, and SLOR(S n ) is The smoothness of the nth preferred dialogue sentence.
  18. 根据权利要求17所述的机器人,其特征在于,所述分别计算各个优选对话语句在预设的基准模型中的第二输出概率包括:18. The robot according to claim 17, wherein said separately calculating the second output probability of each preferred dialogue sentence in a preset reference model comprises:
    分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率;Respectively count the probability of each word in each preferred dialogue sentence appearing in the preset dialogue database;
    根据下式分别计算各个优选对话语句的第二输出概率:Calculate the second output probability of each preferred dialogue sentence according to the following formula:
    Figure PCTCN2019116628-appb-100008
    Figure PCTCN2019116628-appb-100008
    其中,m为各个词语的序号,1≤m≤|S n|,w n,m为第n个优选对话语句中的第m个词语,p(w n,m)为第n个优选对话语句中的第m个词语在所述对话语料库中分别出现的概率。 Where m is the sequence number of each word, 1≤m≤|S n |, w n,m is the mth word in the nth preferred dialogue sentence, and p(w n,m ) is the nth preferred dialogue sentence The probability of the m-th word in, respectively appearing in the dialogue corpus.
  19. 根据权利要求18所述的机器人,其特征在于,在使用预设的对话生成模型对所述输入向量序列进行处理之前,还包括:The robot according to claim 18, characterized in that, before using a preset dialogue generation model to process the input vector sequence, it further comprises:
    确定所述第一对话语句的对话场景;Determine the dialogue scene of the first dialogue sentence;
    从预设的模型集合中选取与所述第一对话语句的对话场景对应的模型作为所述对话生成模型,所述模型集合中包括DN个模型,每个模型均对应于一种对话场景。A model corresponding to the dialogue scene of the first dialogue sentence is selected from a preset model set as the dialogue generation model. The model set includes DN models, and each model corresponds to a dialogue scene.
  20. 根据权利要求19所述的机器人,其特征在于,所述分别统计各个优选对话语句中的各个词语在预设的对话语料库中分别出现的概率包括:The robot according to claim 19, wherein said separately counting the probability of each word in each preferred dialogue sentence appearing in a preset dialogue corpus comprises:
    将预设的对话语料库划分为DN个语料子库,其中,每个语料子库均对应于一种对话场景;Divide the preset dialogue corpus into DN corpus sub-bases, where each corpus sub-base corresponds to a dialogue scene;
    从所述对话语料库中选取优选语料子库,所述优选语料子库为与所述第一对话语句的对话场景对应的语料子库;Selecting a preferred corpus sub-base from the dialogue corpus, where the preferred corpus sub-base is a corpus sub-base corresponding to the dialogue scene of the first dialogue sentence;
    分别统计各个优选对话语句中的各个词语在所述优选语料子库中分别出现的概率。The probability of each word in each preferred dialogue sentence appearing in the preferred corpus is separately counted.
PCT/CN2019/116628 2019-09-18 2019-11-08 Bot conversation generation method, device, readable storage medium, and bot WO2021051507A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910880856.5 2019-09-18
CN201910880856.5A CN110717022A (en) 2019-09-18 2019-09-18 Robot dialogue generation method and device, readable storage medium and robot

Publications (1)

Publication Number Publication Date
WO2021051507A1 true WO2021051507A1 (en) 2021-03-25

Family

ID=69210593

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/116628 WO2021051507A1 (en) 2019-09-18 2019-11-08 Bot conversation generation method, device, readable storage medium, and bot

Country Status (2)

Country Link
CN (1) CN110717022A (en)
WO (1) WO2021051507A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177113A (en) * 2021-05-27 2021-07-27 中国平安人寿保险股份有限公司 Task type dialogue model pre-training method, device, equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231451B (en) * 2020-10-12 2023-09-29 中国平安人寿保险股份有限公司 Reference word recovery method and device, conversation robot and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276326A (en) * 1999-03-25 2000-10-06 Victor Co Of Japan Ltd Device and method for voice input interaction and computer-readable recording medium storing voice input interaction program
CN106095834A (en) * 2016-06-01 2016-11-09 竹间智能科技(上海)有限公司 Intelligent dialogue method and system based on topic
US20180052831A1 (en) * 2016-08-18 2018-02-22 Hyperconnect, Inc. Language translation device and language translation method
CN107870964A (en) * 2017-07-28 2018-04-03 北京中科汇联科技股份有限公司 A kind of sentence sort method and system applied to answer emerging system
CN110046221A (en) * 2019-03-01 2019-07-23 平安科技(深圳)有限公司 A kind of machine dialogue method, device, computer equipment and storage medium
CN110162610A (en) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 Intelligent robot answer method, device, computer equipment and storage medium
CN110209898A (en) * 2019-05-31 2019-09-06 苏州狗尾草智能科技有限公司 Data cleaning method, answering method, device and medium based on human-computer interaction
CN110232117A (en) * 2019-06-13 2019-09-13 北京百度网讯科技有限公司 Sentence fluency detection method, device and terminal

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291701B (en) * 2016-04-01 2020-12-01 阿里巴巴集团控股有限公司 Machine language generation method and device
CN106294325B (en) * 2016-08-11 2019-01-04 海信集团有限公司 The optimization method and device of spatial term sentence
US11238111B2 (en) * 2016-10-24 2022-02-01 International Business Machines Corporation Response generation
CN106897568A (en) * 2017-02-28 2017-06-27 北京大数医达科技有限公司 The treating method and apparatus of case history structuring
CN107229684B (en) * 2017-05-11 2021-05-18 合肥美的智能科技有限公司 Sentence classification method and system, electronic equipment, refrigerator and storage medium
US10424302B2 (en) * 2017-10-12 2019-09-24 Google Llc Turn-based reinforcement learning for dialog management
CN108733644B (en) * 2018-04-09 2019-07-19 平安科技(深圳)有限公司 A kind of text emotion analysis method, computer readable storage medium and terminal device
CN109977201B (en) * 2019-01-28 2023-09-22 平安科技(深圳)有限公司 Machine chat method and device with emotion, computer equipment and storage medium
CN109977207A (en) * 2019-03-21 2019-07-05 网易(杭州)网络有限公司 Talk with generation method, dialogue generating means, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000276326A (en) * 1999-03-25 2000-10-06 Victor Co Of Japan Ltd Device and method for voice input interaction and computer-readable recording medium storing voice input interaction program
CN106095834A (en) * 2016-06-01 2016-11-09 竹间智能科技(上海)有限公司 Intelligent dialogue method and system based on topic
US20180052831A1 (en) * 2016-08-18 2018-02-22 Hyperconnect, Inc. Language translation device and language translation method
CN107870964A (en) * 2017-07-28 2018-04-03 北京中科汇联科技股份有限公司 A kind of sentence sort method and system applied to answer emerging system
CN110046221A (en) * 2019-03-01 2019-07-23 平安科技(深圳)有限公司 A kind of machine dialogue method, device, computer equipment and storage medium
CN110162610A (en) * 2019-04-16 2019-08-23 平安科技(深圳)有限公司 Intelligent robot answer method, device, computer equipment and storage medium
CN110209898A (en) * 2019-05-31 2019-09-06 苏州狗尾草智能科技有限公司 Data cleaning method, answering method, device and medium based on human-computer interaction
CN110232117A (en) * 2019-06-13 2019-09-13 北京百度网讯科技有限公司 Sentence fluency detection method, device and terminal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177113A (en) * 2021-05-27 2021-07-27 中国平安人寿保险股份有限公司 Task type dialogue model pre-training method, device, equipment and storage medium
CN113177113B (en) * 2021-05-27 2023-07-25 中国平安人寿保险股份有限公司 Task type dialogue model pre-training method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110717022A (en) 2020-01-21

Similar Documents

Publication Publication Date Title
US10332507B2 (en) Method and device for waking up via speech based on artificial intelligence
WO2020237869A1 (en) Question intention recognition method and apparatus, computer device, and storage medium
WO2021114840A1 (en) Scoring method and apparatus based on semantic analysis, terminal device, and storage medium
JP7407968B2 (en) Speech recognition method, device, equipment and storage medium
JP6222821B2 (en) Error correction model learning device and program
US11450332B2 (en) Audio conversion learning device, audio conversion device, method, and program
WO2021136029A1 (en) Training method and device for re-scoring model and method and device for speech recognition
WO2020228732A1 (en) Method for training dialog state tracker, and computer device
WO2022095380A1 (en) Ai-based virtual interaction model generation method and apparatus, computer device and storage medium
WO2020168752A1 (en) Speech recognition and speech synthesis method and apparatus based on dual learning
CN111243579B (en) Time domain single-channel multi-speaker voice recognition method and system
WO2021114841A1 (en) User report generating method and terminal device
US20180068652A1 (en) Apparatus and method for training a neural network language model, speech recognition apparatus and method
WO2021204017A1 (en) Text intent recognition method and apparatus, and related device
CN111967264B (en) Named entity identification method
CN110413987B (en) Punctuation mark prediction method based on multiple prediction models and related equipment
WO2021189624A1 (en) Method and apparatus for decoding voice data, computer device and storage medium
WO2021051508A1 (en) Robot dialogue generating method and apparatus, readable storage medium, and robot
CN112687266B (en) Speech recognition method, device, computer equipment and storage medium
CN113158687B (en) Semantic disambiguation method and device, storage medium and electronic device
WO2021051507A1 (en) Bot conversation generation method, device, readable storage medium, and bot
CN112232055B (en) Text detection and correction method based on pinyin similarity and language model
CN111583911A (en) Speech recognition method, device, terminal and medium based on label smoothing
CN110598210A (en) Entity recognition model training method, entity recognition device, entity recognition equipment and medium
CN114694255B (en) Sentence-level lip language recognition method based on channel attention and time convolution network

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: 19945750

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: 19945750

Country of ref document: EP

Kind code of ref document: A1