WO2020224213A1 - Sentence intent identification method, device, and computer readable storage medium - Google Patents

Sentence intent identification method, device, and computer readable storage medium Download PDF

Info

Publication number
WO2020224213A1
WO2020224213A1 PCT/CN2019/117344 CN2019117344W WO2020224213A1 WO 2020224213 A1 WO2020224213 A1 WO 2020224213A1 CN 2019117344 W CN2019117344 W CN 2019117344W WO 2020224213 A1 WO2020224213 A1 WO 2020224213A1
Authority
WO
WIPO (PCT)
Prior art keywords
sentence
intention recognition
model
samples
trained
Prior art date
Application number
PCT/CN2019/117344
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 WO2020224213A1 publication Critical patent/WO2020224213A1/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
    • 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/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking

Definitions

  • This application relates to the technical field of speech semantics, and in particular to a method, device and computer-readable storage medium for sentence intention recognition.
  • This application provides a sentence intention recognition method, device, and computer-readable storage medium, the main purpose of which is to realize the recognition of the current user’s intention according to the context, so that when the user uses natural language expressions to ask questions to the chat robot, Get concise and accurate answers from the chatbot.
  • this application also provides a sentence intention recognition method, which includes:
  • An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  • the present application also provides a sentence intention recognition device, characterized in that the device includes a memory and a processor, the memory stores a sentence intention recognition program that can run on the processor, and When the sentence intention recognition program is executed by the processor, the following steps are implemented:
  • An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  • the present application also provides a computer-readable storage medium having a sentence intention recognition program stored on the computer-readable storage medium, and the sentence intention recognition program can be executed by one or more processors, To realize the steps of the sentence intention recognition method as described above.
  • This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user.
  • This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
  • FIG. 1 is a schematic flowchart of a method for recognizing sentence intentions according to an embodiment of the application
  • FIG. 2 is a schematic diagram of the internal structure of a sentence intention recognition device provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of modules of a sentence intention recognition program in a sentence intention recognition device provided by an embodiment of the application.
  • This application provides a method for identifying sentence intentions.
  • FIG. 1 it is a schematic flowchart of a sentence intention recognition method provided by an embodiment of this application.
  • the method can be executed by a device, and the device can be implemented by software and/or hardware.
  • the sentence intention recognition method includes:
  • the web crawler technology is used to obtain questions asked by users in various application environments from the network.
  • the preprocessing the original sentence sample to obtain the preprocessed sample includes:
  • This link uses the nltk function provided by python to segment the historical dialogue.
  • the specific implementation process is as follows:
  • Use encoding technology to convert each word in the word set into a numeric value that is, use One Hot Encoder encoding technology to convert the string type of the word set into a numeric type, and convert each word into an unordered binary number to generate a one-to-one mapping set.
  • the Normalizer algorithm is used to normalize the values in the mapping set, so that the sum of the values corresponding to each piece of data is 1, and a normalized and planned word mapping set is generated.
  • the extracting sentence feature vectors from the preprocessed sample includes:
  • said extracting text features from the preprocessed sample includes:
  • the PAC technology is used to reduce the dimensionality of text features.
  • the core of the technology is to calculate the appropriateness of the dimensionality using the percentage of variance, that is, to calculate how many dimensions the data set is reduced to.
  • training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model includes:
  • This case uses the linear regression classifier adaptive enhancement algorithm in the Boosting algorithm.
  • the core of the algorithm is an iterative algorithm. In each round of iteration, a new classifier is generated on the low-dimensional dialogue keyword set, and then the classifier is used for all Samples are classified to assess the importance of each sample (informative). Specifically, the algorithm will assign a weight to different categories of low-dimensional dialogue keyword sets. Each time the trained new classifier is used to label each low-dimensional dialogue keyword set sample, if a sample point has been classified correctly, its weight is reduced; if the sample point is not correctly classified, its weight is increased. The higher the weight of the sample, the greater the proportion of the next training, that is to say, the more difficult to distinguish the sample will become more and more important in the training process. The whole iterative process until the error rate is small enough or reaches a certain number of times.
  • the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model includes:
  • the back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
  • each neuron iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
  • the cross-entropy cost function algorithm is introduced in this case, and a weight update that does not include sigmoid is selected for the output layer.
  • the question sentence posed by the user is acquired as the target sentence.
  • the constructed sentence intention recognition model is used to quickly match the most suitable model to obtain a more accurate intention answer.
  • the new question and answer sentences are input into the model.
  • the model quickly performs various steps according to the context, and quickly returns appropriate answers to more accurately solve the user’s problem. Users get satisfactory answers quickly, saving users time.
  • obtaining an answer that matches the intent of the sentence corresponding to the target sentence from the answer database and displaying it to the user includes:
  • This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user.
  • This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
  • the application also provides a sentence intention recognition device.
  • FIG. 2 it is a schematic diagram of the internal structure of a sentence intention recognition device provided by an embodiment of this application.
  • the sentence intention recognition device 1 may be a personal computer (PC), or a terminal device such as a smart phone, a tablet computer, or a portable computer.
  • the sentence intention recognition device 1 at least includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 11 may be an internal storage unit of the sentence intention recognition device 1 in some embodiments, for example, the hard disk of the sentence intention recognition device 1.
  • the memory 11 may also be an external storage device of the sentence intention recognition device 1, for example, a plug-in hard disk equipped on the sentence intention recognition device 1, a smart media card (SMC), and a secure digital (Secure Digital). Digital, SD) card, flash card (Flash Card), etc.
  • the memory 11 may also include both an internal storage unit of the sentence intention recognition apparatus 1 and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed in the sentence intention recognition device 1, such as the code of the sentence intention recognition program 01, etc., but also to temporarily store data that has been output or will be output.
  • the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as execution statement intention recognition program 01, etc.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as execution statement intention recognition program 01, etc.
  • the communication bus 13 is used to realize the connection and communication between these components.
  • the network interface 14 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface), and is usually used to establish a communication connection between the device 1 and other electronic devices.
  • the device 1 may also include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED) touch device, and the like.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the sentence intention recognition device 1 and to display a visualized user interface.
  • FIG. 2 only shows the sentence intention recognition device 1 with components 11-14 and the sentence intention recognition program 01.
  • FIG. 1 does not constitute a limitation on the sentence intention recognition device 1 It may include fewer or more components than shown, or a combination of some components, or a different component arrangement.
  • the sentence intention recognition program 01 is stored in the memory 11; when the processor 12 executes the sentence intention recognition program 01 stored in the memory 11, the following steps are implemented:
  • the web crawler technology is used to obtain questions asked by users in various application environments from the network.
  • the preprocessing the original sentence sample to obtain the preprocessed sample includes:
  • This link uses the nltk function provided by python to segment the historical dialogue.
  • the specific implementation process is as follows:
  • Use encoding technology to convert each word in the word set into a numeric value that is, use One Hot Encoder encoding technology to convert the string type of the word set into a numeric type, and convert each word into an unordered binary number to generate a one-to-one mapping set.
  • the Normalizer algorithm is used to normalize the values in the mapping set, so that the sum of the values corresponding to each piece of data is 1, and a normalized and planned word mapping set is generated.
  • the extracting sentence feature vectors from the preprocessed sample includes:
  • said extracting text features from the preprocessed sample includes:
  • the PAC technology is used to reduce the dimensionality of text features.
  • the core of the technology is to calculate the appropriateness of the dimensionality using the percentage of variance, that is, to calculate how many dimensions the data set is reduced to.
  • a trained sentence intention recognition model is obtained.
  • training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model includes:
  • This case uses the linear regression classifier adaptive enhancement algorithm in the Boosting algorithm.
  • the core of the algorithm is an iterative algorithm. In each round of iteration, a new classifier is generated on the low-dimensional dialogue keyword set, and then the classifier is used for all Samples are classified to assess the importance of each sample (informative). Specifically, the algorithm will assign a weight to different categories of low-dimensional dialogue keyword sets. Each time the trained new classifier is used to label each low-dimensional dialogue keyword set sample, if a sample point has been classified correctly, its weight is reduced; if the sample point is not correctly classified, its weight is increased. The higher the weight of the sample, the greater the proportion of the next training, that is to say, the more difficult to distinguish the sample will become more and more important in the training process. The whole iterative process until the error rate is small enough or reaches a certain number of times.
  • the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model includes:
  • the back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
  • each neuron iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
  • the cross-entropy cost function algorithm is introduced in this case, and a weight update that does not include sigmoid is selected for the output layer.
  • the question sentence posed by the user is acquired as the target sentence.
  • the sentence intention corresponding to the target sentence is output.
  • the constructed sentence intention recognition model is used to quickly match the most suitable model to obtain a more accurate intention answer.
  • the new question and answer sentences are input into the model.
  • the model quickly performs various steps according to the context, and quickly returns appropriate answers to more accurately solve the user’s problem. Users get satisfactory answers quickly, saving users time.
  • An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  • obtaining an answer that matches the intent of the sentence corresponding to the target sentence from the answer database and displaying it to the user includes:
  • This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user.
  • This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
  • the sentence intention recognition program can also be divided into one or more modules, and the one or more modules are stored in the memory 11 and run by one or more processors (in this embodiment, The processor 12) is executed to complete the application.
  • the module referred to in the application refers to a series of computer program instruction segments capable of completing specific functions, and is used to describe the execution process of the sentence intention recognition program in the sentence intention recognition device.
  • FIG. 3 it is a schematic diagram of program modules of the sentence intention recognition program in an embodiment of the sentence intention recognition device of this application.
  • the sentence intention recognition program can be divided into an acquisition module 10 and a preprocessing module 20 , Extraction module 30, training module 40, output module 50 and display module 60, exemplarily:
  • the obtaining module 10 obtains an original sentence sample
  • the preprocessing module 20 preprocesses original sentence samples to obtain preprocessed samples
  • the extraction module 30 extracts sentence feature vectors from the preprocessed samples
  • the training module 40 trains the sentence intention recognition model based on the sentence feature vector and uses the cross-entropy cost function method to obtain a trained sentence intention recognition model;
  • the obtaining module 10 obtains the target sentence to be recognized
  • the output module 50 is based on the target sentence and uses the trained sentence intention recognition model to output the sentence intention corresponding to the target sentence;
  • the display module 60 obtains an answer that matches the intent of the sentence corresponding to the target sentence from the answer database, and displays it to the user.
  • the functions or operation steps implemented by the program modules such as the acquisition module 10, the preprocessing module 20, the extraction module 30, the training module 40, the output module 50, and the display module 60 are substantially the same as those in the foregoing embodiment, and will not be repeated here. .
  • an embodiment of the present application also proposes a computer-readable storage medium having a sentence intention recognition program stored on the computer-readable storage medium, and the sentence intention recognition program can be executed by one or more processors to achieve the following operating:
  • the speech text with the greatest similarity is determined, and the speech text with the greatest similarity is used as the recognition result corresponding to the target sentence data.

Abstract

A sentence intent identification method, a device, and a computer readable storage medium, pertaining to the technical field of speech semantics. The method comprises: pre-processing original sentence samples, and obtaining pre-processed samples (S11); extracting sentence feature vectors from the pre-processed samples (S12); and training, on the basis of the sentence feature vectors, a sentence intent identification model by using a cross-entropy cost function method, and obtaining a trained sentence intent identification model (S13). The method further comprises: acquiring a target sentence to be identified (S14); outputting, on the basis of the target sentence, a sentence intent corresponding to the target sentence by using the trained sentence intent identification model (S15); and acquiring, from an answer database, an answer matching the sentence intent corresponding to the target sentence, and showing the answer to a user (S16). The method enables extraction of abstract features from speech data by using a deep neural network, and achieves accurate sentence identification.

Description

语句意图识别方法、装置及计算机可读存储介质Sentence intention recognition method, device and computer readable storage medium
本申请基于巴黎公约申明享有2019年5月6日递交的申请号为CN201910370432.4、名称为“语句意图识别方法、装置及计算机可读存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。Based on the Paris Convention, this application declares that it enjoys the priority of the Chinese patent application filed on May 6, 2019 with the application number CN201910370432.4 and titled "Sentence Intent Recognition Method, Device and Computer-readable Storage Medium". This Chinese patent application The overall content of is incorporated in this application by reference.
技术领域Technical field
本申请涉及语音语义技术领域,尤其涉及一种语句意图识别方法、装置及计算机可读存储介质。This application relates to the technical field of speech semantics, and in particular to a method, device and computer-readable storage medium for sentence intention recognition.
背景技术Background technique
在聊天机器人多轮对话中如何根据上下文理解用户的意图是多轮交互中的一个重点问题,也是一个难点问题。现有的问句理解方法大多是针对单句的,且侧重于某种句式结构的理解。如何根据上下文语境对当前用户的意图进行识别,而不仅仅是针对单轮进行一个个分析,使得对话在一个连续的语境下具备细粒度的理解能力,是一个亟待解决的问题。How to understand the user's intention according to the context in the multi-round conversation of a chatbot is an important and difficult problem in multi-round interaction. The existing question comprehension methods are mostly for single sentences, and focus on the understanding of certain sentence structure. How to identify the current user's intentions based on the context, not just a single round of analysis, so that the dialogue has a fine-grained understanding ability in a continuous context is an urgent problem to be solved.
发明内容Summary of the invention
本申请提供一种语句意图识别方法、装置及计算机可读存储介质,其主要目的在于实现根据上下文语境对当前用户的意图进行识别,使得用户使用自然语言的表达方式向聊天机器人问问题时,得到聊天机器人返回简洁准确的答案。This application provides a sentence intention recognition method, device, and computer-readable storage medium, the main purpose of which is to realize the recognition of the current user’s intention according to the context, so that when the user uses natural language expressions to ask questions to the chat robot, Get concise and accurate answers from the chatbot.
为实现上述目的,本申请还提供一种语句意图识别方法,所述方法包括:In order to achieve the above objective, this application also provides a sentence intention recognition method, which includes:
获取原始语句样本;Obtain a sample of the original sentence;
预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model;
获取待识别的目标语句;Get the target sentence to be recognized;
基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence;
从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
为实现上述目的,本申请还提供一种语句意图识别装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的语句意图识别程序,所述语句意图识别程序被所述处理器执行时实现如下步骤:In order to achieve the above objective, the present application also provides a sentence intention recognition device, characterized in that the device includes a memory and a processor, the memory stores a sentence intention recognition program that can run on the processor, and When the sentence intention recognition program is executed by the processor, the following steps are implemented:
获取原始语句样本;Obtain a sample of the original sentence;
预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model;
获取待识别的目标语句;Get the target sentence to be recognized;
基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence;
从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有语句意图识别程序,所述语句意图识别程序可被一个或者多个处理器执行,以实现如上所述的语句意图识别方法的步骤。In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium having a sentence intention recognition program stored on the computer-readable storage medium, and the sentence intention recognition program can be executed by one or more processors, To realize the steps of the sentence intention recognition method as described above.
本申请获取原始语句样本;预处理原始语句样本,得到预处理后的样本;从所述预处理后的样本中提取语句特征向量;基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;获取待识别的目标语句;基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。本申请实现根据上下文语境对当前用户的意图进行识别,使得用户使用自然语言的表达方式向聊天机器人问问题时,得到聊天机器人返回简洁准确的答案。This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user. This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
附图说明Description of the drawings
图1为本申请一实施例提供的语句意图识别方法的流程示意图;FIG. 1 is a schematic flowchart of a method for recognizing sentence intentions according to an embodiment of the application;
图2为本申请一实施例提供的语句意图识别装置的内部结构示意图;2 is a schematic diagram of the internal structure of a sentence intention recognition device provided by an embodiment of the application;
图3为本申请一实施例提供的语句意图识别装置中语句意图识别程序的模块示意图。3 is a schematic diagram of modules of a sentence intention recognition program in a sentence intention recognition device provided by an embodiment of the application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.
本申请提供一种语句意图识别方法。参照图1所示,为本申请一实施例提供的语句意图识别方法的流程示意图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。This application provides a method for identifying sentence intentions. Referring to FIG. 1, it is a schematic flowchart of a sentence intention recognition method provided by an embodiment of this application. The method can be executed by a device, and the device can be implemented by software and/or hardware.
在本实施例中,语句意图识别方法包括:In this embodiment, the sentence intention recognition method includes:
S10、获取原始语句样本。S10. Obtain an original sentence sample.
在本实施例中,利用网络爬虫技术从网络上获取各种应用环境下的用户向机器提问的问句。In this embodiment, the web crawler technology is used to obtain questions asked by users in various application environments from the network.
S11、预处理原始语句样本,得到预处理后的样本。S11. Preprocess the original sentence sample to obtain a preprocessed sample.
优选地,所述预处理原始语句样本,得到预处理后的样本包括:Preferably, the preprocessing the original sentence sample to obtain the preprocessed sample includes:
(1)利用自然语言处理技术对原始语句样本进行分词,得到分词后的语句。(1) Use natural language processing technology to segment the original sentence samples to get the sentence after the word segmentation.
此环节使用python提供的nltk功能,对历史对话进行分词,具体实现流程如下:This link uses the nltk function provided by python to segment the historical dialogue. The specific implementation process is as follows:
将原始语句样本导入Import original sentence samples
导入nltk模块,使用nltk模块的切词功能对每个句子进行单词切分,得到单个的词语Import the nltk module and use the word segmentation function of the nltk module to segment each sentence to get a single word
导入停用词表,去除到没有意思含义和介词、助动词等功能性词,生成表征对话含义的单词集。Import the stop word list to remove the meaningless meaning and functional words such as prepositions and auxiliary verbs to generate a set of words that represent the meaning of the dialogue.
(2)利用编码技术对分词后的语句进行转码操作,得到转码后的样本。(2) Use coding technology to transcode the sentence after word segmentation to obtain transcoded samples.
使用编码技术将单词集中每一个单词进行数值转换,即使用One Hot Encoder编码技术将单词集的字符串类型转换成数值类型,将每个单词转换成没有顺序的二进制数字,生成一一对应的映射集。Use encoding technology to convert each word in the word set into a numeric value, that is, use One Hot Encoder encoding technology to convert the string type of the word set into a numeric type, and convert each word into an unordered binary number to generate a one-to-one mapping set.
(3)利用归一化方法对转码后的样本进行规范化处理,得到预处理后的样本。(3) Use the normalization method to normalize the transcoded samples to obtain the preprocessed samples.
为了满足后续模型算法对数据的要求,使用Normalizer算法,对映射集中的数值进行归一化处理,使每条数据对应的数值和为1,生成归一化规划性的词语映射集。In order to meet the data requirements of the subsequent model algorithm, the Normalizer algorithm is used to normalize the values in the mapping set, so that the sum of the values corresponding to each piece of data is 1, and a normalized and planned word mapping set is generated.
S12、从所述预处理后的样本中提取语句特征向量。S12. Extract a sentence feature vector from the preprocessed sample.
优选地,所述从所述预处理后的样本中提取语句特征向量包括:Preferably, the extracting sentence feature vectors from the preprocessed sample includes:
从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
在一实施例中,优选地,所述从所述预处理后的样本中提取文本特征包括:In an embodiment, preferably, said extracting text features from the preprocessed sample includes:
从预处理后的样本中提取文本词语;Extract text words from the preprocessed samples;
利用聚类算法对文本词语进行聚类,选择聚类中心作为一个主要关键词,Use a clustering algorithm to cluster text words and select the cluster center as a main keyword.
计算其他文本词语与聚类中心的距离,选择前N个距离聚类中心最近的词作为所述文本特征。Calculate the distance between other text words and the cluster center, and select the first N words closest to the cluster center as the text feature.
在一实施例中,使用PAC技术对文本特征进行降维,技术核心是用方差的百分比计算维度的合适度,即计算将数据集降到多少维是比较合适的。In one embodiment, the PAC technology is used to reduce the dimensionality of text features. The core of the technology is to calculate the appropriateness of the dimensionality using the percentage of variance, that is, to calculate how many dimensions the data set is reduced to.
S13、基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型。S13. Train the sentence intention recognition model based on the sentence feature vector and use the cross-entropy cost function method to obtain a trained sentence intention recognition model.
优选地,所述基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型包括:Preferably, training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model includes:
利用线性回归分类器对语句特征向量进行分类,生成每个类别的分类模型;Use linear regression classifiers to classify sentence feature vectors and generate classification models for each category;
将每个类别的分类模型进行集成,得到集成后的分类模型;Integrate the classification models of each category to obtain the integrated classification model;
利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型;Use the LSTM deep neural network model to train the integrated classification model to obtain the trained classification model;
使用交叉熵代价函数算法优化训练后的分类模型,输出语句意图识别模型。Use the cross-entropy cost function algorithm to optimize the trained classification model, and output the sentence intention recognition model.
本案使用Boosting算法中的线性回归分类器自适应增强算法,算法核心是一种迭代算法,每轮迭代中会在低维对话关键词集上产生一个新的分类器,然后使用该分类器对所有样本进行分类,以评估每个样本的重要性(informative)。具体来说,算法会为不同类别的低维对话关键词集赋予一个权值。每次用训练完的新分类器标注各个低维对话关键词集样本,若某个样本点已被分类正确,则将其权值降低;若样本点未被正确分类,则提高其权值。权值越高的样本在下一次训练中所占的比重越大,也就是说越难区分的样本在训练过程中会变得越来越重要。整个迭代过程直到错误率足够小或达到一定次数为止。This case uses the linear regression classifier adaptive enhancement algorithm in the Boosting algorithm. The core of the algorithm is an iterative algorithm. In each round of iteration, a new classifier is generated on the low-dimensional dialogue keyword set, and then the classifier is used for all Samples are classified to assess the importance of each sample (informative). Specifically, the algorithm will assign a weight to different categories of low-dimensional dialogue keyword sets. Each time the trained new classifier is used to label each low-dimensional dialogue keyword set sample, if a sample point has been classified correctly, its weight is reduced; if the sample point is not correctly classified, its weight is increased. The higher the weight of the sample, the greater the proportion of the next training, that is to say, the more difficult to distinguish the sample will become more and more important in the training process. The whole iterative process until the error rate is small enough or reaches a certain number of times.
优选地,所述利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型包括:Preferably, the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model includes:
将集成后的分类模型转换成一个向量;Convert the integrated classification model into a vector;
基于所述向量,前向计算LSTM深度神经网络模型中每个神经元的输出值;Based on the vector, forward calculating the output value of each neuron in the LSTM deep neural network model;
反向计算LSTM深度神经网络模型中每个神经元的误差项值,LSTM误差项的反向传播包括两个方向:一个是沿时间的反向传播,即从当前t时刻开始,计算每个时刻的误差项;一个是将误差项向上一层传播;Backward calculation of the error term value of each neuron in the LSTM deep neural network model. The back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
根据每个神经元的误差项值,迭代计算LSTM深度神经网络模型中每个权重的梯度,直至迭代终止,输出训练后的分类模型。According to the error term value of each neuron, iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
本申请在使用LSTM深度神经网络模型时,当神经元的输出接近1时,造成学习缓慢,为了解决此问题,本案引入交叉熵代价函数算法,对输出层选择一个不包含sigmoid的权值更新。When the LSTM deep neural network model is used in this application, when the output of the neuron is close to 1, the learning is slow. To solve this problem, the cross-entropy cost function algorithm is introduced in this case, and a weight update that does not include sigmoid is selected for the output layer.
S14、获取待识别的目标语句。S14. Obtain the target sentence to be recognized.
在本实施例中,获取用户提问的问句作为目标语句。In this embodiment, the question sentence posed by the user is acquired as the target sentence.
S15、基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图。S15. Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence.
在本实施例中,当发生新的机器问答对话时,使用构建好的语句意图识别模型,快速匹配最适宜的模型,得到较为精准的意图回答。In this embodiment, when a new machine question-and-answer dialogue occurs, the constructed sentence intention recognition model is used to quickly match the most suitable model to obtain a more accurate intention answer.
在训练优化好的深度学习模型的基础上,将发生的新的问答语句输入到模型中,模型快速根据上下文语境进行各步骤操作,迅速返回适宜的回答,较为准确地解决用户的问题,让用户快速得到满意的答案,节约用户时间。Based on the training and optimization of the deep learning model, the new question and answer sentences are input into the model. The model quickly performs various steps according to the context, and quickly returns appropriate answers to more accurately solve the user’s problem. Users get satisfactory answers quickly, saving users time.
S16、从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。S16. Obtain an answer that matches the intent of the sentence corresponding to the target sentence from the answer database, and display it to the user.
优选地,从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户包括:Preferably, obtaining an answer that matches the intent of the sentence corresponding to the target sentence from the answer database and displaying it to the user includes:
从答案数据库中获取多个与所述目标语句对应的语句意图匹配的答案;Obtaining a plurality of answers matching the intent of the sentence corresponding to the target sentence from the answer database;
计算每个匹配的答案与用户意图的相似度;Calculate the similarity between each matched answer and the user's intention;
按照相似度大小,从大到小排序,并展示给用户。According to the similarity, sort from largest to smallest, and display to users.
本申请获取原始语句样本;预处理原始语句样本,得到预处理后的样本;从所述预处理后的样本中提取语句特征向量;基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;获取待识别的目标语句;基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。本申请实现根据上下文语境对当前用户的意图进行识别,使得用户使用自然语言的表达方式向聊天机器人问问题时,得到聊天机器人返回简洁准确的答案。This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user. This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
本申请还提供一种语句意图识别装置。参照图2所示,为本申请一实施例提供的语句意图识别装置的内部结构示意图。The application also provides a sentence intention recognition device. Referring to FIG. 2, it is a schematic diagram of the internal structure of a sentence intention recognition device provided by an embodiment of this application.
在本实施例中,语句意图识别装置1可以是个人电脑(Personal Computer,PC),也可以是智能手机、平板电脑、便携计算机等终端设备。该语句意图识别装置1至少包括存储器11、处理器12,通信总线13,以及网络接口14。In this embodiment, the sentence intention recognition device 1 may be a personal computer (PC), or a terminal device such as a smart phone, a tablet computer, or a portable computer. The sentence intention recognition device 1 at least includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是语句意图识别装置1的内部存储单元,例如该语句意图识别装置1的硬盘。存储器11在另一些实施例中也可以是语句意图识别装置1的外部存储设备,例如语句意图识别装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器 11还可以既包括语句意图识别装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于语句意图识别装置1的应用软件及各类数据,例如语句意图识别程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. The memory 11 may be an internal storage unit of the sentence intention recognition device 1 in some embodiments, for example, the hard disk of the sentence intention recognition device 1. In other embodiments, the memory 11 may also be an external storage device of the sentence intention recognition device 1, for example, a plug-in hard disk equipped on the sentence intention recognition device 1, a smart media card (SMC), and a secure digital (Secure Digital). Digital, SD) card, flash card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the sentence intention recognition apparatus 1 and an external storage device. The memory 11 can be used not only to store application software and various data installed in the sentence intention recognition device 1, such as the code of the sentence intention recognition program 01, etc., but also to temporarily store data that has been output or will be output.
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行语句意图识别程序01等。The processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as execution statement intention recognition program 01, etc.
通信总线13用于实现这些组件之间的连接通信。The communication bus 13 is used to realize the connection and communication between these components.
网络接口14可选的可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该装置1与其他电子设备之间建立通信连接。The network interface 14 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface), and is usually used to establish a communication connection between the device 1 and other electronic devices.
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及有机发光二极管(Organic Light-Emitting Diode,OLED)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在语句意图识别装置1中处理的信息以及用于显示可视化的用户界面。Optionally, the device 1 may also include a user interface. The user interface may include a display (Display) and an input unit such as a keyboard (Keyboard). The optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED) touch device, and the like. Among them, the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the sentence intention recognition device 1 and to display a visualized user interface.
图2仅示出了具有组件11-14以及语句意图识别程序01的语句意图识别装置1,本领域技术人员可以理解的是,图1示出的结构并不构成对语句意图识别装置1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 2 only shows the sentence intention recognition device 1 with components 11-14 and the sentence intention recognition program 01. Those skilled in the art will understand that the structure shown in FIG. 1 does not constitute a limitation on the sentence intention recognition device 1 It may include fewer or more components than shown, or a combination of some components, or a different component arrangement.
在图2所示的装置1实施例中,存储器11中存储有语句意图识别程序01;处理器12执行存储器11中存储的语句意图识别程序01时实现如下步骤:In the embodiment of the device 1 shown in FIG. 2, the sentence intention recognition program 01 is stored in the memory 11; when the processor 12 executes the sentence intention recognition program 01 stored in the memory 11, the following steps are implemented:
获取原始语句样本。Get a sample of the original sentence.
在本实施例中,利用网络爬虫技术从网络上获取各种应用环境下的用户向机器提问的问句。In this embodiment, the web crawler technology is used to obtain questions asked by users in various application environments from the network.
预处理原始语句样本,得到预处理后的样本。Prepare the original sentence sample to obtain the preprocessed sample.
优选地,所述预处理原始语句样本,得到预处理后的样本包括:Preferably, the preprocessing the original sentence sample to obtain the preprocessed sample includes:
(1)利用自然语言处理技术对原始语句样本进行分词,得到分词后的语句。(1) Use natural language processing technology to segment the original sentence samples to get the sentence after the word segmentation.
此环节使用python提供的nltk功能,对历史对话进行分词,具体实现流程如下:This link uses the nltk function provided by python to segment the historical dialogue. The specific implementation process is as follows:
将原始语句样本导入Import original sentence samples
导入nltk模块,使用nltk模块的切词功能对每个句子进行单词切分,得到单个的词语Import the nltk module and use the word segmentation function of the nltk module to segment each sentence to get a single word
导入停用词表,去除到没有意思含义和介词、助动词等功能性词,生成表征对话含义的单词集。Import the stop word list to remove the meaningless meaning and functional words such as prepositions and auxiliary verbs to generate a set of words that represent the meaning of the dialogue.
(2)利用编码技术对分词后的语句进行转码操作,得到转码后的样本。(2) Use coding technology to transcode the sentence after word segmentation to obtain transcoded samples.
使用编码技术将单词集中每一个单词进行数值转换,即使用One Hot Encoder编码技术将单词集的字符串类型转换成数值类型,将每个单词转换成没有顺序的二进制数字,生成一一对应的映射集。Use encoding technology to convert each word in the word set into a numeric value, that is, use One Hot Encoder encoding technology to convert the string type of the word set into a numeric type, and convert each word into an unordered binary number to generate a one-to-one mapping set.
(3)利用归一化方法对转码后的样本进行规范化处理,得到预处理后的样本。(3) Use the normalization method to normalize the transcoded samples to obtain the preprocessed samples.
为了满足后续模型算法对数据的要求,使用Normalizer算法,对映射集中的数值进行归一化处理,使每条数据对应的数值和为1,生成归一化规划性的词语映射集。In order to meet the data requirements of the subsequent model algorithm, the Normalizer algorithm is used to normalize the values in the mapping set, so that the sum of the values corresponding to each piece of data is 1, and a normalized and planned word mapping set is generated.
从所述预处理后的样本中提取语句特征向量。Extract sentence feature vectors from the preprocessed samples.
优选地,所述从所述预处理后的样本中提取语句特征向量包括:Preferably, the extracting sentence feature vectors from the preprocessed sample includes:
从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
在一实施例中,优选地,所述从所述预处理后的样本中提取文本特征包括:In an embodiment, preferably, said extracting text features from the preprocessed sample includes:
从预处理后的样本中提取文本词语;Extract text words from the preprocessed samples;
利用聚类算法对文本词语进行聚类,选择聚类中心作为一个主要关键词,Use a clustering algorithm to cluster text words and select the cluster center as a main keyword.
计算其他文本词语与聚类中心的距离,选择前N个距离聚类中心最近的词作为所述文本特征。Calculate the distance between other text words and the cluster center, and select the first N words closest to the cluster center as the text feature.
在一实施例中,使用PAC技术对文本特征进行降维,技术核心是用方差的百分比计算维度的合适度,即计算将数据集降到多少维是比较合适的。In one embodiment, the PAC technology is used to reduce the dimensionality of text features. The core of the technology is to calculate the appropriateness of the dimensionality using the percentage of variance, that is, to calculate how many dimensions the data set is reduced to.
基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型。Based on the sentence feature vector and using the cross-entropy cost function method to train the sentence intention recognition model, a trained sentence intention recognition model is obtained.
优选地,所述基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型包括:Preferably, training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model includes:
利用线性回归分类器对语句特征向量进行分类,生成每个类别的分类模型;Use linear regression classifiers to classify sentence feature vectors and generate classification models for each category;
将每个类别的分类模型进行集成,得到集成后的分类模型;Integrate the classification models of each category to obtain the integrated classification model;
利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型;Use the LSTM deep neural network model to train the integrated classification model to obtain the trained classification model;
使用交叉熵代价函数算法优化训练后的分类模型,输出语句意图识别模型。Use the cross-entropy cost function algorithm to optimize the trained classification model, and output the sentence intention recognition model.
本案使用Boosting算法中的线性回归分类器自适应增强算法,算法核心是一种迭代算法,每轮迭代中会在低维对话关键词集上产生一个新的分类器,然后使用该分类器对所有样本进行分类,以评估每个样本的重要性(informative)。具体来说,算法会为不同类别的低维对话关键词集赋予一个权值。每次用训练完的新分类器标注各个低维对话关键词集样本,若某个样本点已被分类正确,则将其权值降低;若样本点未被正确分类,则提高其权值。权值越高的样本在下一次训练中所占的比重越大,也就是说越难区分的样本在训练过程中会变得越来越重要。整个迭代过程直到错误率足够小或达到一定次数为止。This case uses the linear regression classifier adaptive enhancement algorithm in the Boosting algorithm. The core of the algorithm is an iterative algorithm. In each round of iteration, a new classifier is generated on the low-dimensional dialogue keyword set, and then the classifier is used for all Samples are classified to assess the importance of each sample (informative). Specifically, the algorithm will assign a weight to different categories of low-dimensional dialogue keyword sets. Each time the trained new classifier is used to label each low-dimensional dialogue keyword set sample, if a sample point has been classified correctly, its weight is reduced; if the sample point is not correctly classified, its weight is increased. The higher the weight of the sample, the greater the proportion of the next training, that is to say, the more difficult to distinguish the sample will become more and more important in the training process. The whole iterative process until the error rate is small enough or reaches a certain number of times.
优选地,所述利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型包括:Preferably, the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model includes:
将集成后的分类模型转换成一个向量;Convert the integrated classification model into a vector;
基于所述向量,前向计算LSTM深度神经网络模型中每个神经元的输出值;Based on the vector, forward calculating the output value of each neuron in the LSTM deep neural network model;
反向计算LSTM深度神经网络模型中每个神经元的误差项值,LSTM误差项的反向传播包括两个方向:一个是沿时间的反向传播,即从当前t时刻开始,计算每个时刻的误差项;一个是将误差项向上一层传播;Backward calculation of the error term value of each neuron in the LSTM deep neural network model. The back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
根据每个神经元的误差项值,迭代计算LSTM深度神经网络模型中每个权重的梯度,直至迭代终止,输出训练后的分类模型。According to the error term value of each neuron, iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
本申请在使用LSTM深度神经网络模型时,当神经元的输出接近1时,造成学习缓慢,为了解决此问题,本案引入交叉熵代价函数算法,对输出层 选择一个不包含sigmoid的权值更新。When the LSTM deep neural network model is used in this application, when the output of the neuron is close to 1, the learning is slow. To solve this problem, the cross-entropy cost function algorithm is introduced in this case, and a weight update that does not include sigmoid is selected for the output layer.
获取待识别的目标语句。Get the target sentence to be recognized.
在本实施例中,获取用户提问的问句作为目标语句。In this embodiment, the question sentence posed by the user is acquired as the target sentence.
基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图。Based on the target sentence, and using the trained sentence intention recognition model, the sentence intention corresponding to the target sentence is output.
在本实施例中,当发生新的机器问答对话时,使用构建好的语句意图识别模型,快速匹配最适宜的模型,得到较为精准的意图回答。In this embodiment, when a new machine question-and-answer dialogue occurs, the constructed sentence intention recognition model is used to quickly match the most suitable model to obtain a more accurate intention answer.
在训练优化好的深度学习模型的基础上,将发生的新的问答语句输入到模型中,模型快速根据上下文语境进行各步骤操作,迅速返回适宜的回答,较为准确地解决用户的问题,让用户快速得到满意的答案,节约用户时间。Based on the training and optimization of the deep learning model, the new question and answer sentences are input into the model. The model quickly performs various steps according to the context, and quickly returns appropriate answers to more accurately solve the user’s problem. Users get satisfactory answers quickly, saving users time.
从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
优选地,从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户包括:Preferably, obtaining an answer that matches the intent of the sentence corresponding to the target sentence from the answer database and displaying it to the user includes:
从答案数据库中获取多个与所述目标语句对应的语句意图匹配的答案;Obtaining a plurality of answers matching the intent of the sentence corresponding to the target sentence from the answer database;
计算每个匹配的答案与用户意图的相似度;Calculate the similarity between each matched answer and the user's intention;
按照相似度大小,从大到小排序,并展示给用户。According to the similarity, sort from largest to smallest, and display to users.
本申请获取原始语句样本;预处理原始语句样本,得到预处理后的样本;从所述预处理后的样本中提取语句特征向量;基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;获取待识别的目标语句;基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。本申请实现根据上下文语境对当前用户的意图进行识别,使得用户使用自然语言的表达方式向聊天机器人问问题时,得到聊天机器人返回简洁准确的答案。This application obtains original sentence samples; preprocesses the original sentence samples to obtain preprocessed samples; extracts sentence feature vectors from the preprocessed samples; trains sentences based on the sentence feature vectors and uses the cross-entropy cost function method Intent recognition model to obtain the trained sentence intent recognition model; obtain the target sentence to be recognized; based on the target sentence, and use the trained sentence intent recognition model to output the sentence intent corresponding to the target sentence; obtain the sentence intent corresponding to the target sentence from the answer database The sentence intent to match the answer corresponding to the target sentence is displayed to the user. This application realizes the recognition of the current user's intention based on the context, so that when the user asks a question to the chat robot using natural language expressions, the chat robot returns a concise and accurate answer.
可选地,在其他实施例中,语句意图识别程序还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行以完成本申请,本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述语句意图识别程序在语句意图识别装置中的执行过程。Optionally, in other embodiments, the sentence intention recognition program can also be divided into one or more modules, and the one or more modules are stored in the memory 11 and run by one or more processors (in this embodiment, The processor 12) is executed to complete the application. The module referred to in the application refers to a series of computer program instruction segments capable of completing specific functions, and is used to describe the execution process of the sentence intention recognition program in the sentence intention recognition device.
例如,参照图3所示,为本申请语句意图识别装置一实施例中的语句意图识别程序的程序模块示意图,该实施例中,语句意图识别程序可以被分割为获取模块10、预处理模块20、提取模块30、训练模块40、输出模块50及展示模块60,示例性地:For example, referring to FIG. 3, it is a schematic diagram of program modules of the sentence intention recognition program in an embodiment of the sentence intention recognition device of this application. In this embodiment, the sentence intention recognition program can be divided into an acquisition module 10 and a preprocessing module 20 , Extraction module 30, training module 40, output module 50 and display module 60, exemplarily:
获取模块10获取原始语句样本;The obtaining module 10 obtains an original sentence sample;
预处理模块20预处理原始语句样本,得到预处理后的样本;The preprocessing module 20 preprocesses original sentence samples to obtain preprocessed samples;
提取模块30从所述预处理后的样本中提取语句特征向量;The extraction module 30 extracts sentence feature vectors from the preprocessed samples;
训练模块40基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;The training module 40 trains the sentence intention recognition model based on the sentence feature vector and uses the cross-entropy cost function method to obtain a trained sentence intention recognition model;
所述获取模块10获取待识别的目标语句;The obtaining module 10 obtains the target sentence to be recognized;
输出模块50基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;The output module 50 is based on the target sentence and uses the trained sentence intention recognition model to output the sentence intention corresponding to the target sentence;
展示模块60从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。The display module 60 obtains an answer that matches the intent of the sentence corresponding to the target sentence from the answer database, and displays it to the user.
上述获取模块10、预处理模块20、提取模块30、训练模块40、输出模块50及展示模块60等程序模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。The functions or operation steps implemented by the program modules such as the acquisition module 10, the preprocessing module 20, the extraction module 30, the training module 40, the output module 50, and the display module 60 are substantially the same as those in the foregoing embodiment, and will not be repeated here. .
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有语句意图识别程序,所述语句意图识别程序可被一个或多个处理器执行,以实现如下操作:In addition, an embodiment of the present application also proposes a computer-readable storage medium having a sentence intention recognition program stored on the computer-readable storage medium, and the sentence intention recognition program can be executed by one or more processors to achieve the following operating:
获取原始语句样本;Obtain a sample of the original sentence;
预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
利用所述语句特征向量训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model by using the sentence feature vector to obtain a trained sentence intention recognition model;
获取待识别的目标语句数据;Obtain the target sentence data to be recognized;
基于目标语句数据,并利用训练好的语句意图识别模型,输出所述目标语句数据对应的多个不同概率的语音文本;Based on the target sentence data, and using the trained sentence intention recognition model, output multiple speech texts with different probabilities corresponding to the target sentence data;
根据所述多个不同概率的语音文本中,确定相似度最大的语音文本,并 将所述相似度最大的语音文本作为所述目标语句数据对应的识别结果。According to the multiple speech texts with different probabilities, the speech text with the greatest similarity is determined, and the speech text with the greatest similarity is used as the recognition result corresponding to the target sentence data.
本申请计算机可读存储介质具体实施方式与上述语句意图识别装置和方法各实施例基本相同,在此不作累述。The specific implementation of the computer-readable storage medium of the present application is basically the same as the above-mentioned sentence intention recognition device and method, and will not be repeated here.
需要说明的是,上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。It should be noted that the serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. And the terms "include", "include" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes The other elements listed may also include elements inherent to the process, device, article, or method. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, device, article or method that includes the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) execute the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种语句意图识别方法,其特征在于,所述方法包括:A method for recognizing sentence intention, characterized in that the method includes:
    获取原始语句样本;Obtain a sample of the original sentence;
    预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
    从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
    基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model;
    获取待识别的目标语句;Get the target sentence to be recognized;
    基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence;
    从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  2. 如权利要求1所述的语句意图识别方法,其特征在于,所述预处理原始语句样本,得到预处理后的样本包括:The sentence intention recognition method according to claim 1, wherein the preprocessing the original sentence sample to obtain the preprocessed sample comprises:
    利用自然语言处理技术对原始语句样本进行分词,得到分词后的语句;Use natural language processing technology to segment the original sentence samples to obtain the sentence after word segmentation;
    利用编码技术对分词后的语句进行转码操作,得到转码后的样本;Use coding technology to transcode the sentence after word segmentation to obtain transcoded samples;
    利用归一化方法对转码后的样本进行规范化处理,得到预处理后的样本。The normalization method is used to normalize the transcoded samples to obtain pre-processed samples.
  3. 如权利要求1所述的语句意图识别方法,其特征在于,所述从所述预处理后的样本中提取语句特征向量包括:The sentence intention recognition method according to claim 1, wherein said extracting sentence feature vectors from said preprocessed sample comprises:
    从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
    利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
  4. 如权利要求3所述的语句意图识别方法,其特征在于,所述从所述预处理后的样本中提取语句特征向量包括:5. The sentence intention recognition method according to claim 3, wherein said extracting sentence feature vector from said preprocessed sample comprises:
    从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
    利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
  5. 如权利要求1所述的语句意图识别方法,其特征在于,所述基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型包括:The sentence intention recognition method according to claim 1, wherein said training sentence intention recognition model based on said sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model comprises:
    利用线性回归分类器对语句特征向量进行分类,生成每个类别的分类模 型;Use linear regression classifiers to classify sentence feature vectors and generate classification models for each category;
    将每个类别的分类模型进行集成,得到集成后的分类模型;Integrate the classification models of each category to obtain the integrated classification model;
    利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型;Use the LSTM deep neural network model to train the integrated classification model to obtain the trained classification model;
    使用交叉熵代价函数算法优化训练后的分类模型,输出语句意图识别模型。Use the cross-entropy cost function algorithm to optimize the trained classification model, and output the sentence intention recognition model.
  6. 如权利要求5所述的语句意图识别方法,其特征在于,所述利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型包括:The sentence intention recognition method according to claim 5, wherein the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model comprises:
    将集成后的分类模型转换成一个向量;Convert the integrated classification model into a vector;
    基于所述向量,前向计算LSTM深度神经网络模型中每个神经元的输出值;Based on the vector, forward calculating the output value of each neuron in the LSTM deep neural network model;
    反向计算LSTM深度神经网络模型中每个神经元的误差项值,LSTM误差项的反向传播包括两个方向:一个是沿时间的反向传播,即从当前t时刻开始,计算每个时刻的误差项;一个是将误差项向上一层传播;Backward calculation of the error term value of each neuron in the LSTM deep neural network model. The back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
    根据每个神经元的误差项值,迭代计算LSTM深度神经网络模型中每个权重的梯度,直至迭代终止,输出训练后的分类模型。According to the error term value of each neuron, iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
  7. 如权利要求1至6任一项所述的语句意图识别方法,其特征在于,从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户包括:The sentence intention recognition method according to any one of claims 1 to 6, wherein obtaining an answer matching the sentence intention corresponding to the target sentence from an answer database and displaying it to the user comprises:
    从答案数据库中获取多个与所述目标语句对应的语句意图匹配的答案;Obtaining a plurality of answers matching the intent of the sentence corresponding to the target sentence from the answer database;
    计算每个匹配的答案与用户意图的相似度;Calculate the similarity between each matched answer and the user's intention;
    按照相似度大小,从大到小排序,并展示给用户。According to the similarity, sort from largest to smallest, and display to users.
  8. 一种语句意图识别装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的语句意图识别程序,所述语句意图识别程序被所述处理器执行时实现如下步骤:A sentence intention recognition device, characterized in that the device includes a memory and a processor, the memory stores a sentence intention recognition program that can run on the processor, and the sentence intention recognition program is processed by the processor. The following steps are implemented when the device is executed:
    获取步骤:获取预设数量的带噪语音及与各带噪语音对应的去噪语音,作为训练样本,将所述训练样本分为第一数据集、第二数据集及第三数据集;Obtaining step: obtaining a preset number of noisy speech and denoising speech corresponding to each noisy speech as training samples, and dividing the training samples into a first data set, a second data set, and a third data set;
    获取原始语句样本;Obtain a sample of the original sentence;
    预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
    从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
    基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model;
    获取待识别的目标语句;Get the target sentence to be recognized;
    基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence;
    从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  9. 如权利要求8所述的语句意图识别装置,其特征在于,所述预处理原始语句样本,得到预处理后的样本包括:8. The sentence intention recognition device of claim 8, wherein the preprocessing the original sentence sample to obtain the preprocessed sample comprises:
    利用自然语言处理技术对原始语句样本进行分词,得到分词后的语句;Use natural language processing technology to segment the original sentence samples to obtain the sentence after word segmentation;
    利用编码技术对分词后的语句进行转码操作,得到转码后的样本;Use coding technology to transcode the sentence after word segmentation to obtain transcoded samples;
    利用归一化方法对转码后的样本进行规范化处理,得到预处理后的样本。The normalization method is used to normalize the transcoded samples to obtain pre-processed samples.
  10. 如权利要求8所述的语句意图识别装置,其特征在于,所述从所述预处理后的样本中提取语句特征向量包括:8. The sentence intention recognition device according to claim 8, wherein said extracting sentence feature vectors from said preprocessed sample comprises:
    从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
    利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
  11. 如权利要求10所述的语句意图识别装置,其特征在于,所述从所述预处理后的样本中提取文本特征包括:9. The sentence intention recognition device according to claim 10, wherein said extracting text features from said preprocessed sample comprises:
    从预处理后的样本中提取文本词语;Extract text words from the preprocessed samples;
    利用聚类算法对文本词语进行聚类,选择聚类中心作为一个主要关键词,Use a clustering algorithm to cluster text words and select the cluster center as a main keyword.
    计算其他文本词语与聚类中心的距离,选择前N个距离聚类中心最近的词作为所述文本特征。Calculate the distance between other text words and the cluster center, and select the first N words closest to the cluster center as the text feature.
  12. 如权利要求8所述的语句意图识别装置,其特征在于,所述基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型包括:8. The sentence intention recognition device according to claim 8, wherein said training sentence intention recognition model based on said sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model comprises:
    利用线性回归分类器对语句特征向量进行分类,生成每个类别的分类模型;Use linear regression classifiers to classify sentence feature vectors and generate classification models for each category;
    将每个类别的分类模型进行集成,得到集成后的分类模型;Integrate the classification models of each category to obtain the integrated classification model;
    利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型;Use the LSTM deep neural network model to train the integrated classification model to obtain the trained classification model;
    使用交叉熵代价函数算法优化训练后的分类模型,输出语句意图识别模型。Use the cross-entropy cost function algorithm to optimize the trained classification model, and output the sentence intention recognition model.
  13. 如权利要求12所述的语句意图识别装置,其特征在于,所述利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型包括:The sentence intention recognition device according to claim 12, wherein the training of the integrated classification model using the LSTM deep neural network model to obtain the trained classification model comprises:
    将集成后的分类模型转换成一个向量;Convert the integrated classification model into a vector;
    基于所述向量,前向计算LSTM深度神经网络模型中每个神经元的输出值;Based on the vector, forward calculating the output value of each neuron in the LSTM deep neural network model;
    反向计算LSTM深度神经网络模型中每个神经元的误差项值,LSTM误差项的反向传播包括两个方向:一个是沿时间的反向传播,即从当前t时刻开始,计算每个时刻的误差项;一个是将误差项向上一层传播;Backward calculation of the error term value of each neuron in the LSTM deep neural network model. The back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
    根据每个神经元的误差项值,迭代计算LSTM深度神经网络模型中每个权重的梯度,直至迭代终止,输出训练后的分类模型。According to the error term value of each neuron, iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
  14. 如权利要求8至13任一项所述的语句意图识别装置,其特征在于,从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户包括:The sentence intention recognition device according to any one of claims 8 to 13, wherein obtaining an answer matching the sentence intention corresponding to the target sentence from an answer database and displaying it to the user comprises:
    从答案数据库中获取多个与所述目标语句对应的语句意图匹配的答案;Obtaining a plurality of answers matching the intent of the sentence corresponding to the target sentence from the answer database;
    计算每个匹配的答案与用户意图的相似度;Calculate the similarity between each matched answer and the user's intention;
    按照相似度大小,从大到小排序,并展示给用户。According to the similarity, sort from largest to smallest, and display to users.
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中包括语句意图识别程序,所述语句意图识别程序被处理器执行时,实现如下步骤:A computer-readable storage medium, wherein the computer-readable storage medium includes a sentence intention recognition program, and when the sentence intention recognition program is executed by a processor, the following steps are implemented:
    获取原始语句样本;Obtain a sample of the original sentence;
    预处理原始语句样本,得到预处理后的样本;Prepare the original sentence sample to obtain the preprocessed sample;
    从所述预处理后的样本中提取语句特征向量;Extracting sentence feature vectors from the preprocessed samples;
    基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型;Training a sentence intention recognition model based on the sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model;
    获取待识别的目标语句;Get the target sentence to be recognized;
    基于目标语句,并利用训练好的语句意图识别模型,输出所述目标语句对应的语句意图;Based on the target sentence, and using the trained sentence intention recognition model, output the sentence intention corresponding to the target sentence;
    从答案数据库中获取与所述目标语句对应的语句意图匹配的答案,并展示给用户。An answer that matches the intent of the sentence corresponding to the target sentence is obtained from the answer database and displayed to the user.
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述预处理原始语句样本,得到预处理后的样本包括:15. The computer-readable storage medium of claim 15, wherein the preprocessing the original sentence sample to obtain the preprocessed sample comprises:
    利用自然语言处理技术对原始语句样本进行分词,得到分词后的语句;Use natural language processing technology to segment the original sentence samples to obtain the sentence after word segmentation;
    利用编码技术对分词后的语句进行转码操作,得到转码后的样本;Use coding technology to transcode the sentence after word segmentation to obtain transcoded samples;
    利用归一化方法对转码后的样本进行规范化处理,得到预处理后的样本。The normalization method is used to normalize the transcoded samples to obtain pre-processed samples.
  17. 如权利要求15所述的计算机可读存储介质,其特征在于,所述从所述预处理后的样本中提取语句特征向量包括:15. The computer-readable storage medium of claim 15, wherein said extracting sentence feature vectors from said preprocessed sample comprises:
    从所述预处理后的样本中提取文本特征;Extracting text features from the preprocessed sample;
    利用PCA技术对文本特征进行特征降维,得到语句特征向量。Using PCA technology to perform feature reduction on text features to obtain sentence feature vectors.
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述从所述预处理后的样本中提取文本特征包括:17. The computer-readable storage medium of claim 17, wherein said extracting text features from said preprocessed sample comprises:
    从预处理后的样本中提取文本词语;Extract text words from the preprocessed samples;
    利用聚类算法对文本词语进行聚类,选择聚类中心作为一个主要关键词,Use a clustering algorithm to cluster text words and select the cluster center as a main keyword.
    计算其他文本词语与聚类中心的距离,选择前N个距离聚类中心最近的词作为所述文本特征。Calculate the distance between other text words and the cluster center, and select the first N words closest to the cluster center as the text feature.
  19. 如权利要求15所述的计算机可读存储介质,其特征在于,所述基于所述语句特征向量,并利用交叉熵代价函数方法训练语句意图识别模型,得到训练好的语句意图识别模型包括:15. The computer-readable storage medium according to claim 15, wherein said training a sentence intention recognition model based on said sentence feature vector and using a cross-entropy cost function method to obtain a trained sentence intention recognition model comprises:
    利用线性回归分类器对语句特征向量进行分类,生成每个类别的分类模型;Use linear regression classifiers to classify sentence feature vectors and generate classification models for each category;
    将每个类别的分类模型进行集成,得到集成后的分类模型;Integrate the classification models of each category to obtain the integrated classification model;
    利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型;Use the LSTM deep neural network model to train the integrated classification model to obtain the trained classification model;
    使用交叉熵代价函数算法优化训练后的分类模型,输出语句意图识别模型。Use the cross-entropy cost function algorithm to optimize the trained classification model, and output the sentence intention recognition model.
  20. 如权利要求19所述的计算机可读存储介质,其特征在于,所述利用LSTM深度神经网络模型训练集成后的分类模型,得到训练后的分类模型包括:The computer-readable storage medium of claim 19, wherein the training of the integrated classification model by using the LSTM deep neural network model to obtain the trained classification model comprises:
    将集成后的分类模型转换成一个向量;Convert the integrated classification model into a vector;
    基于所述向量,前向计算LSTM深度神经网络模型中每个神经元的输出值;Based on the vector, forward calculating the output value of each neuron in the LSTM deep neural network model;
    反向计算LSTM深度神经网络模型中每个神经元的误差项值,LSTM误差项的反向传播包括两个方向:一个是沿时间的反向传播,即从当前t时刻开始,计算每个时刻的误差项;一个是将误差项向上一层传播;Backward calculation of the error term value of each neuron in the LSTM deep neural network model. The back propagation of the LSTM error term includes two directions: one is the back propagation along time, that is, starting from the current time t, calculate each time The error term of; one is to propagate the error term to the upper level;
    根据每个神经元的误差项值,迭代计算LSTM深度神经网络模型中每个权重的梯度,直至迭代终止,输出训练后的分类模型。According to the error term value of each neuron, iteratively calculate the gradient of each weight in the LSTM deep neural network model, until the iteration ends, and output the trained classification model.
PCT/CN2019/117344 2019-05-06 2019-11-12 Sentence intent identification method, device, and computer readable storage medium WO2020224213A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910370432.4 2019-05-06
CN201910370432.4A CN110232114A (en) 2019-05-06 2019-05-06 Sentence intension recognizing method, device and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2020224213A1 true WO2020224213A1 (en) 2020-11-12

Family

ID=67861174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117344 WO2020224213A1 (en) 2019-05-06 2019-11-12 Sentence intent identification method, device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN110232114A (en)
WO (1) WO2020224213A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434133A (en) * 2020-12-02 2021-03-02 康佳集团股份有限公司 Intention classification method and device, intelligent terminal and storage medium
CN113255351A (en) * 2021-06-22 2021-08-13 中国平安财产保险股份有限公司 Sentence intention recognition method and device, computer equipment and storage medium

Families Citing this family (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232114A (en) * 2019-05-06 2019-09-13 平安科技(深圳)有限公司 Sentence intension recognizing method, device and computer readable storage medium
CN110795913B (en) * 2019-09-30 2024-04-12 北京大米科技有限公司 Text encoding method, device, storage medium and terminal
CN111046653B (en) * 2019-11-14 2023-12-29 深圳市优必选科技股份有限公司 Statement identification method, statement identification device and intelligent equipment
CN110909543A (en) * 2019-11-15 2020-03-24 广州洪荒智能科技有限公司 Intention recognition method, device, equipment and medium
CN112287077A (en) * 2019-12-09 2021-01-29 北京来也网络科技有限公司 Statement extraction method and device for combining RPA and AI for document, storage medium and electronic equipment
CN111199149B (en) * 2019-12-17 2023-10-20 航天信息股份有限公司 Sentence intelligent clarification method and system for dialogue system
CN110990576B (en) * 2019-12-24 2023-06-16 用友网络科技股份有限公司 Intention classification method based on active learning, computer equipment and storage medium
CN111143561B (en) * 2019-12-26 2023-04-07 北京百度网讯科技有限公司 Intention recognition model training method and device and electronic equipment
CN111079448A (en) * 2019-12-31 2020-04-28 出门问问信息科技有限公司 Intention identification method and device
CN111221942A (en) * 2020-01-09 2020-06-02 平安科技(深圳)有限公司 Intelligent text conversation generation method and device and computer readable storage medium
CN111221944B (en) * 2020-01-13 2024-04-23 平安科技(深圳)有限公司 Text intention recognition method, device, equipment and storage medium
CN111382231B (en) * 2020-03-05 2022-07-08 思必驰科技股份有限公司 Intention recognition system and method
CN111325037B (en) * 2020-03-05 2022-03-29 苏宁云计算有限公司 Text intention recognition method and device, computer equipment and storage medium
CN111400495A (en) * 2020-03-17 2020-07-10 重庆邮电大学 Video bullet screen consumption intention identification method based on template characteristics
CN111506757A (en) * 2020-04-10 2020-08-07 复旦大学 Voice marking device and method based on incremental iteration
CN111538823A (en) * 2020-04-26 2020-08-14 支付宝(杭州)信息技术有限公司 Information processing method, model training method, device, equipment and medium
CN111581388B (en) * 2020-05-11 2023-09-19 北京金山安全软件有限公司 User intention recognition method and device and electronic equipment
CN111625634B (en) * 2020-05-25 2023-08-22 泰康保险集团股份有限公司 Word slot recognition method and device, computer readable storage medium and electronic equipment
CN111708873B (en) * 2020-06-15 2023-11-24 腾讯科技(深圳)有限公司 Intelligent question-answering method, intelligent question-answering device, computer equipment and storage medium
CN111710328B (en) * 2020-06-16 2024-01-12 北京爱医声科技有限公司 Training sample selection method, device and medium for speech recognition model
CN112052663B (en) * 2020-08-31 2022-08-02 平安科技(深圳)有限公司 Customer service statement quality inspection method and related equipment
CN112256864A (en) * 2020-09-23 2021-01-22 北京捷通华声科技股份有限公司 Multi-intention recognition method and device, electronic equipment and readable storage medium
CN112214998B (en) * 2020-11-16 2023-08-22 中国平安财产保险股份有限公司 Method, device, equipment and storage medium for joint identification of intention and entity
CN112417121A (en) * 2020-11-20 2021-02-26 平安普惠企业管理有限公司 Client intention recognition method and device, computer equipment and storage medium
CN112542173A (en) * 2020-11-30 2021-03-23 珠海格力电器股份有限公司 Voice interaction method, device, equipment and medium
CN113111159A (en) * 2021-04-21 2021-07-13 康键信息技术(深圳)有限公司 Question and answer record generation method and device, electronic equipment and storage medium
CN113268578B (en) * 2021-06-24 2023-08-29 中国平安人寿保险股份有限公司 Text semantic recognition method and device, computer equipment and storage medium
CN114818738A (en) * 2022-03-01 2022-07-29 达而观信息科技(上海)有限公司 Method and system for identifying user intention track of customer service hotline
CN115408509B (en) * 2022-11-01 2023-02-14 杭州一知智能科技有限公司 Intention identification method, system, electronic equipment and storage medium
CN117350302B (en) * 2023-11-04 2024-04-02 湖北为华教育科技集团有限公司 Semantic analysis-based language writing text error correction method, system and man-machine interaction device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030191625A1 (en) * 1999-11-05 2003-10-09 Gorin Allen Louis Method and system for creating a named entity language model
CN105389307A (en) * 2015-12-02 2016-03-09 上海智臻智能网络科技股份有限公司 Statement intention category identification method and apparatus
CN105487663A (en) * 2015-11-30 2016-04-13 北京光年无限科技有限公司 Intelligent robot oriented intention identification method and system
CN110232114A (en) * 2019-05-06 2019-09-13 平安科技(深圳)有限公司 Sentence intension recognizing method, device and computer readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106934221A (en) * 2017-02-27 2017-07-07 华南理工大学 A kind of water quality assessment sorting technique based on neutral net
CN106991506A (en) * 2017-05-16 2017-07-28 深圳先进技术研究院 Intelligent terminal and its stock trend forecasting method based on LSTM
CN108427722A (en) * 2018-02-09 2018-08-21 卫盈联信息技术(深圳)有限公司 intelligent interactive method, electronic device and storage medium
CN109214410A (en) * 2018-07-10 2019-01-15 上海斐讯数据通信技术有限公司 A kind of method and system promoting multi-tag classification accuracy rate
CN109241255B (en) * 2018-08-20 2021-05-18 华中师范大学 Intention identification method based on deep learning

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030191625A1 (en) * 1999-11-05 2003-10-09 Gorin Allen Louis Method and system for creating a named entity language model
CN105487663A (en) * 2015-11-30 2016-04-13 北京光年无限科技有限公司 Intelligent robot oriented intention identification method and system
CN105389307A (en) * 2015-12-02 2016-03-09 上海智臻智能网络科技股份有限公司 Statement intention category identification method and apparatus
CN110232114A (en) * 2019-05-06 2019-09-13 平安科技(深圳)有限公司 Sentence intension recognizing method, device and computer readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112434133A (en) * 2020-12-02 2021-03-02 康佳集团股份有限公司 Intention classification method and device, intelligent terminal and storage medium
CN113255351A (en) * 2021-06-22 2021-08-13 中国平安财产保险股份有限公司 Sentence intention recognition method and device, computer equipment and storage medium
CN113255351B (en) * 2021-06-22 2023-02-03 中国平安财产保险股份有限公司 Sentence intention recognition method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110232114A (en) 2019-09-13

Similar Documents

Publication Publication Date Title
WO2020224213A1 (en) Sentence intent identification method, device, and computer readable storage medium
CN107783960B (en) Method, device and equipment for extracting information
WO2021068321A1 (en) Information pushing method and apparatus based on human-computer interaction, and computer device
WO2020224097A1 (en) Intelligent semantic document recommendation method and device, and computer-readable storage medium
US20230195773A1 (en) Text classification method, apparatus and computer-readable storage medium
WO2020232861A1 (en) Named entity recognition method, electronic device and storage medium
WO2019153522A1 (en) Intelligent interaction method, electronic device, and storage medium
CN110569366A (en) text entity relation extraction method and device and storage medium
WO2020147395A1 (en) Emotion-based text classification method and device, and computer apparatus
WO2021135469A1 (en) Machine learning-based information extraction method, apparatus, computer device, and medium
CN113094578B (en) Deep learning-based content recommendation method, device, equipment and storage medium
CN108038208B (en) Training method and device of context information recognition model and storage medium
US20220406034A1 (en) Method for extracting information, electronic device and storage medium
CN111241828A (en) Intelligent emotion recognition method and device and computer readable storage medium
CN112699686B (en) Semantic understanding method, device, equipment and medium based on task type dialogue system
CN112632226B (en) Semantic search method and device based on legal knowledge graph and electronic equipment
CN110704586A (en) Information processing method and system
CN111898550B (en) Expression recognition model building method and device, computer equipment and storage medium
WO2020248366A1 (en) Text intention intelligent classification method and device, and computer-readable storage medium
CN112395421B (en) Course label generation method and device, computer equipment and medium
CN111783471A (en) Semantic recognition method, device, equipment and storage medium of natural language
CN112000778A (en) Natural language processing method, device and system based on semantic recognition
CN111339775A (en) Named entity identification method, device, terminal equipment and storage medium
CN111984780A (en) Multi-intention recognition model training method, multi-intention recognition method and related device
WO2021042529A1 (en) Article abstract automatic generation method, device, and computer-readable storage medium

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

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

Country of ref document: EP

Kind code of ref document: A1