WO2023272616A1 - 一种文本理解方法、系统、终端设备和存储介质 - Google Patents

一种文本理解方法、系统、终端设备和存储介质 Download PDF

Info

Publication number
WO2023272616A1
WO2023272616A1 PCT/CN2021/103714 CN2021103714W WO2023272616A1 WO 2023272616 A1 WO2023272616 A1 WO 2023272616A1 CN 2021103714 W CN2021103714 W CN 2021103714W WO 2023272616 A1 WO2023272616 A1 WO 2023272616A1
Authority
WO
WIPO (PCT)
Prior art keywords
recognition model
text
intent
labeling
short text
Prior art date
Application number
PCT/CN2021/103714
Other languages
English (en)
French (fr)
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 东莞市小精灵教育软件有限公司
Priority to PCT/CN2021/103714 priority Critical patent/WO2023272616A1/zh
Publication of WO2023272616A1 publication Critical patent/WO2023272616A1/zh

Links

Images

Classifications

    • 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

  • S011 obtains a short text corpus, and extracts corresponding word vectors from the short text corpus through a pre-training layer;
  • S100 acquires session information of the user, and converts the session information into text to be recognized
  • the text to be recognized converted from conversation information is input into the trained target recognition model, the text to be recognized is recognized by the target recognition model, and the intent category and keywords corresponding to the text to be recognized are output.
  • the terminal device recognizes the keyword and the intent type corresponding to the output session information at the same time through the target recognition model. It is necessary to successively identify and acquire the keywords corresponding to the session information and their intent types, and simultaneously output the keywords and intent types in parallel, which can reduce the time of waiting for recognition successively, thereby greatly improving the efficiency of user intent recognition.
  • this method of outputting keywords and intent types in parallel at the same time makes the keywords and intent types in the session information relatable, and then can accurately and effectively identify the user intent corresponding to the session information, which greatly improves user intent recognition. the accuracy rate.
  • S011 obtains a short text corpus, and extracts corresponding word vectors from the short text corpus through a pre-training layer;
  • connection layer After extracting the feature information of the word vector by the pooling layer, the connection layer is used to classify and mark the intention, and at the same time, the part-of-speech tag is carried out to the word vector through the labeling layer;
  • Deep learning in the context of deep learning, in order to achieve better predictions, parameterized deep neural networks or ensemble models (integrating many weak models) are often used, which can often achieve better predictions.
  • over-parameterization and integrated models require a large amount of calculation and computing resources, which is very unfavorable for deployment.
  • Deep learning has achieved enormous results in computer vision, speech recognition, natural language processing and many other fields.
  • most of these models are too computationally expensive to run on mobile phones or embedded devices.
  • Knowledge distillation refers to the idea of model compression by using a larger trained network step by step to teach a smaller network exactly what to do.
  • the terminal device After the terminal device obtains the candidate recognition model through transfer learning in the above manner, it adjusts the parameters of the candidate recognition model according to the verification result of the test set by the pending recognition model (for convenience of description, hereinafter referred to as the first parameter adjustment) , and adjust the parameters of the candidate recognition model according to the short text corpus in the test set (for convenience of description, hereinafter referred to as the second parameter adjustment), and the terminal device sets the first weight ratio of the first parameter adjustment, and The second weight ratio adjusted by the second parameter, the sum of the first weight ratio and the second weight ratio is 1, so that the terminal device adjusts the parameters of the candidate recognition model according to the verification result and the short text corpus in the test set, and then Generate the object recognition model.
  • the terminal device adaptively adjusts the proportion of the first weight ratio and the second weight ratio according to the accuracy of the verification result of the test set by the undetermined recognition model. For example, if the undetermined recognition model is used for the If the accuracy rate of the verification result of the test set is greater than the preset value, then the second weight ratio is greater than the first weight ratio. If the accuracy rate of the verification result of the test set according to the undetermined recognition model is less than a preset value, then the second weight ratio is smaller than the first weight ratio.
  • the present invention shares the BERT layer vector, and cuts the BERT layer according to the specific model effect to achieve the effect of reducing training time and model size.
  • Short text intent and keyword fusion training less training time, while increasing the overall accuracy and reducing time-consuming.
  • the training time of the neural network model for identifying user intentions is greatly reduced, and the compression and cutting of the knowledge distillation algorithm can effectively reduce the size of the neural network model for identifying user intentions, that is, the target recognition model, and at the same time obtain the intention and the key words in order to improve the accuracy of user intent recognition.
  • a conversion module configured to acquire user session information, and convert the session information into text to be recognized
  • the present invention is applicable to the voice human-computer interaction process of users using terminal equipment.
  • Terminal equipment includes but is not limited to tutoring machines, learning machines, computers, smart phones, telephone watches, smart desk lamps, smart earphones and other electronic products, as well as robots, Intelligent devices such as drones and unmanned vehicles.
  • the content of the session information may be in various forms, for example, it may be in the form of text information, voice information, and the like.
  • the conversation information is information in the form of text
  • the text content in the conversation information can be directly recognized to obtain the text to be recognized.
  • speech recognition may be performed on the conversation information in speech form to obtain the text to be recognized.
  • the terminal device collects and acquires the sound signal as the conversation information through the microphone or the microphone array, and then, the terminal device extracts the conversation information in the form of the user's voice from the sound signal through the speech recognition technology and converts it into the text to be recognized. It should be noted that the terminal device collects and obtains the sound signal within the voice collection range, extracts the user's conversation information from the sound, and converts the conversation information into the text to be recognized.
  • the specific process includes:
  • Recognition module for by target recognition model from described to-be-recognized text, output corresponding intent category and keyword respectively simultaneously;
  • the target recognition model is based on samples marked with intent categories and keywords at the same time, and a recognition model is obtained by training at the same time.
  • the terminal device inputs the text to be recognized into the target recognition model, and the target recognition model simultaneously outputs the intent category and keywords corresponding to the text to be recognized.
  • a processing module configured to obtain user intentions corresponding to the session information according to the intention categories and keywords.
  • the keyword types include verbs, nouns, quantifiers, numerals and the like.
  • the intent type includes behavior type intent, query type intent and other user intents, and user other intent refers to other intents except behavior type intent and query type intent.
  • Behavior type intentions include intentions with prescriptive or imperative descriptions.
  • the natural language corresponding to user behavior intentions is generally in the command format, such as: playing music, learning new words, etc.
  • the subdivision includes commanding terminal devices to control external devices to change the status of external devices (including working state and running state), or the intention to command the terminal device to change its own state (including working state and running state).
  • Query type intents include intents with descriptions of questions, doubts, and segments include query, search, ask, etc. of questions.
  • the terminal device After the terminal device recognizes the intent category and keyword corresponding to the session information through the above embodiment, it combines the intent category and the keyword to obtain multiple sets of candidate intents, and compares the similarity of each set of candidate intents with the session information, and compares the similarity The candidate intent with the highest degree is used as the user intent corresponding to the session information.
  • the present invention After receiving the session information input by the user, the present invention not only determines the keywords corresponding to the session information, but also determines the intent type corresponding to the session information, and obtains the intent recognition result according to the keywords and intent types corresponding to the session information as user intent.
  • the present invention uses the target recognition model to simultaneously identify the keywords corresponding to the output session information and their intention types, without waiting for the keyword recognition results, and then identify the user's intentions according to the keywords, that is to say, the present invention does not need to be sequenced
  • the method of identifying keywords and their intent types corresponding to acquired session information, and simultaneously outputting keywords and intent types in parallel can reduce the time of waiting for recognition, which in turn can greatly improve the efficiency of user intent recognition.
  • this method of outputting keywords and intent types in parallel at the same time makes the keywords and intent types in the session information relatable, and then can accurately and effectively identify the user intent corresponding to the session information, which greatly improves user intent recognition. the accuracy rate.
  • the corpus acquisition module is used to obtain short text corpus
  • the terminal device After the terminal device collects and acquires a large amount of short text corpus, it performs preprocessing and word segmentation processing on the short text corpus. That is, the terminal device first preprocesses the short text corpus, and then performs text sentence segmentation on the short text corpus to obtain multiple text sentences. The terminal device then uses the preset word segmentation dictionary to perform word segmentation processing on multiple text sentences, and obtains multiple word segmentation results. Then, the terminal device tags the multiple word segmentation results according to a preset information tagging algorithm (for example, a CRF algorithm, namely a conditional random field algorithm).
  • a preset information tagging algorithm for example, a CRF algorithm, namely a conditional random field algorithm.
  • the terminal device tags the word segmentation results, it tags the corresponding tagging sequence for the word segmentation results, that is, the tagged word segmentation results of each short text corpus are connected and combined according to the word order, so as to obtain multiple tagged short text corpora.
  • Classification and labeling module used for classifying and labeling the short text corpus and keyword labeling
  • a training module configured to perform training according to the training set to generate a corresponding candidate recognition model
  • the generation module is used to adjust the parameters of the candidate recognition model according to the test set and the verification set to generate the target recognition model.
  • the text to be recognized converted from the conversation information is input into the trained target recognition model, the text to be recognized is recognized through the target recognition model, and the intent category and keywords corresponding to the text to be recognized are output.
  • the terminal device recognizes the keyword and the intent type corresponding to the output session information at the same time through the target recognition model. It is necessary to successively identify and acquire the keywords corresponding to the session information and their intent types, and simultaneously output the keywords and intent types in parallel, which can reduce the time of waiting for recognition successively, thereby greatly improving the efficiency of user intent recognition.
  • this method of outputting keywords and intent types in parallel at the same time makes the keywords and intent types in the session information relatable, and then can accurately and effectively identify the user intent corresponding to the session information, which greatly improves user intent recognition. the accuracy rate.
  • the generating module includes:
  • an adjustment generating unit configured to adjust parameters of the candidate recognition model according to the verification set, and generate a corresponding undetermined recognition model
  • the training set is used to estimate the model
  • the validation set is used to determine the network structure or the parameters that control the complexity of the model
  • the test set is used to test the performance of the final optimal model.
  • the terminal device divides and obtains the training set, the verification set and the test set through the above embodiments, it uses the training set for training to generate corresponding candidate recognition models. Then, the terminal device adjusts the parameters of the candidate recognition models according to the verification set to generate a corresponding pending recognition model.
  • a model clipping unit configured to clip the pending recognition model according to a knowledge distillation algorithm to obtain a candidate recognition model
  • the present invention according to the training set, verification set and test set, the calculation amount and calculation resources of the target parameter model obtained by training are very large. Therefore, the present invention first trains a large and strong pending recognition model, and then transfers the knowledge contained in the pending recognition model to a small candidate recognition model, thus completing the compression and cutting of the pending recognition model.
  • the terminal device introduces soft targets related to the teacher network (ie, the undetermined recognition model) as part of the overall loss, and establishes the corresponding relationship between the intermediate output of the student network (ie, the candidate recognition network) and the teacher network.
  • the output information of a certain layer in the teacher network can be directly transmitted to the student network to induce the training of the student network to achieve knowledge transfer.
  • the terminal device After the terminal device obtains the candidate recognition model through transfer learning in the above manner, it adjusts the parameters of the candidate recognition model according to the verification result of the test set by the pending recognition model (for convenience of description, hereinafter referred to as the first parameter adjustment) , and adjust the parameters of the candidate recognition model according to the short text corpus in the test set (for convenience of description, hereinafter referred to as the second parameter adjustment), and the terminal device sets the first weight ratio of the first parameter adjustment, and The second weight ratio adjusted by the second parameter, the sum of the first weight ratio and the second weight ratio is 1, so that the terminal device adjusts the parameters of the candidate recognition model according to the verification result and the short text corpus in the test set, and then Generate the object recognition model.
  • the terminal device adaptively adjusts the proportion of the first weight ratio and the second weight ratio according to the accuracy of the verification result of the test set by the undetermined recognition model. For example, if the undetermined recognition model is used for the If the accuracy rate of the verification result of the test set is greater than the preset value, then the second weight ratio is greater than the first weight ratio. If the accuracy rate of the verification result of the test set according to the undetermined recognition model is less than a preset value, then the second weight ratio is smaller than the first weight ratio.
  • the present invention shares the BERT layer vector, and cuts the BERT layer according to the specific model effect, so as to achieve the effect of reducing training time and model size.
  • Short text intent and keyword fusion training less training time, while increasing the overall accuracy and reducing time-consuming.
  • the training time of the neural network model for identifying user intentions is greatly reduced, and the compression and cutting of the knowledge distillation algorithm can effectively reduce the size of the neural network model for identifying user intentions, that is, the target recognition model, and at the same time obtain the intention and the key words in order to improve the accuracy of user intent recognition.
  • the classification labeling module includes:
  • An extraction unit is used to extract corresponding word vectors from the short text corpus through the pre-training layer
  • the terminal device After the terminal device obtains a large amount of short text corpus, it inputs the short text corpus into the Bert layer or the tokenizer, and extracts word vectors corresponding to each short text corpus through the Bert layer or the tokenizer. Specifically, the terminal device performs word segmentation on the short text corpus through the Bert layer or a word segmenter to obtain word segmentation results. After obtaining the word segmentation results corresponding to the short text corpus, it can generate word vectors corresponding to each word based on the word segmentation results, and then complete the short text. Word vector extraction from corpus. Wherein, the process of generating the word vector corresponding to the word segmentation can be realized through the existing technology, which will not be repeated here.
  • the short text corpus is "Help my dad book a high-speed rail ticket from Beijing to Shanghai next Wednesday"
  • the word segmenter to segment the short text corpus to get the word segmentation result
  • word vectors corresponding to each word segmentation can be generated according to the word segmentation results.
  • the target recognition model trained by the terminal device is based on the pre-built short text corpus marked with "intent sentence-intent type + keyword", that is, each short text corpus is marked with the corresponding intent type + keyword, and also corresponds to If there are intentional sentences, just input the conversational information into the target recognition model, and perform a similarity comparison to find the target short text corpus with the highest similarity to the intent type and keywords of the conversational information, and then retrieve it through the target short text corpus
  • the corresponding intent statement is the user intent corresponding to the session information.
  • the present invention can identify and output user intentions by matching conversational sentences with intention types and keywords of short text corpus, improves the accuracy of user intention identification, improves the accuracy of user intention identification, and reduces manpower consumption and labeling data requirements.
  • the classification and labeling unit is used to extract the feature information of the word vector through the pooling layer, and then perform intention classification and labeling by the connection layer, and at the same time, perform part-of-speech labeling on the word vector through the labeling layer.
  • the terminal device obtains the word vector through the BERT layer through the short text corpus, and after extracting the feature information of the short text corpus through the avg_pool layer (that is, the pooling layer of the present invention), it passes through the linear layer (that is, the pooling layer of the present invention)
  • the terminal device performs part-of-speech tagging on the obtained word vector through the CRF layer (ie, the tagging layer of the present invention), so that subsequent association training can be performed simultaneously according to the intent category and keywords to obtain the target recognition model .
  • word segmentation and part-of-speech tagging belong to the category of natural language processing methods, which can be implemented using toolkits such as LTP and StanfordParser.
  • the word vector of the short text corpus can be used as the input of the target recognition model to be trained, and the intention category of the user intention corresponding to the short text corpus and the keywords under the intention category can be used as output.
  • the parameter information of the target recognition model is obtained through training, that is, the trained target recognition model is obtained.
  • the text to be recognized converted from conversation information is input into the trained target recognition model, the text to be recognized is recognized by the target recognition model, and the intent category and keywords corresponding to the text to be recognized are output.
  • the terminal device recognizes the keyword and the intent type corresponding to the output session information at the same time through the target recognition model. It is necessary to successively identify and acquire the keywords corresponding to the session information and their intent types, and simultaneously output the keywords and intent types in parallel, which can reduce the time of waiting for recognition successively, thereby greatly improving the efficiency of user intent recognition.
  • this method of outputting keywords and intent types in parallel at the same time makes the keywords and intent types in the session information relatable, and then can accurately and effectively identify the user intent corresponding to the session information, which greatly improves user intent recognition. the accuracy rate.
  • a terminal device includes a processor and a memory, wherein the memory is used to store computer programs; the processor is used to execute the computer programs stored in the memory to implement the above-mentioned corresponding method embodiments approach to text understanding.
  • the terminal device may be a desktop computer, a notebook, a palmtop computer, a tablet computer, a mobile phone, a human-computer interaction screen and the like.
  • the terminal device may include, but not limited to, a processor and a memory.
  • Terminal devices may also include input/output interfaces, display devices, network access devices, communication buses, communication interfaces, and the like.
  • the communication interface and the communication bus may also include an input/output interface, wherein the processor, the memory, the input/output interface and the communication interface communicate with each other through the communication bus.
  • the memory stores a computer program, and the processor is used to execute the computer program stored in the memory to implement the text understanding method in the corresponding method embodiment above.
  • the processor can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), on-site Programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the storage may be an internal storage unit of the terminal device, for example: a hard disk or a memory of the terminal device.
  • the memory may also be an external storage device of the terminal device, for example: a plug-in hard disk equipped on the terminal device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, Flash card (Flash Card), etc.
  • the memory may also include both an internal storage unit of the terminal device and an external storage device.
  • the memory is used to store the computer program and other programs and data required by the terminal device.
  • the memory can also be used to temporarily store data that has been output or will be output.
  • a communication bus is the electrical circuitry that connects the described elements and enables transmissions between the elements.
  • the processor receives commands from other elements through the communication bus, decrypts the received commands, and performs calculation or data processing according to the decrypted commands.
  • the memory may include program modules, such as kernel (kernel), middleware (middleware), application programming interface (Application Programming Interface, API) and applications.
  • the program module may be composed of software, firmware or hardware, or at least two of them.
  • the input/output interface forwards commands or data entered by the user through the input/output interface (eg sensor, keyboard, touch screen).
  • the communication interface connects the terminal device with other network devices, user equipment, and the network.
  • the communication interface may be connected to the network through wires or wirelessly to connect to other external network devices or user devices.
  • Wireless communication may include at least one of the following: Wireless Fidelity (WiFi), Bluetooth (BT), Near Field Communication (NFC), Global Positioning System (GPS), and cellular communication, among others.
  • the wired communication may include at least one of the following: Universal Serial Bus (USB), High Definition Multimedia Interface (HDMI), Asynchronous Transfer Standard Interface (RS-232) and so on.
  • the network may be a telecommunications network and a communication network.
  • the communication network may be a computer network, the Internet, the Internet of Things, or a telephone network.
  • the terminal device can be connected to the network through a communication interface, and the protocol used for communication between the terminal device and other network devices can be supported by at least one of the application, application programming interface (API), middleware, kernel, and communication interface.
  • API application programming interface
  • An embodiment of the present invention is a storage medium, at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the corresponding embodiment of the above-mentioned text understanding method.
  • the storage medium may be read only memory (ROM), random access memory (RAM), compact disk read only (CD-ROM), magnetic tape, floppy disk, and optical data storage device, among others.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated module/unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a storage medium. Based on such an understanding, the present invention realizes all or part of the processes in the methods of the above-mentioned embodiments, and it can also be completed by sending instructions to related hardware through a computer program.
  • the computer program can be stored in a storage medium. When executed by a processor, the steps in the foregoing method embodiments can be realized.
  • the computer program may be in the form of source code, object code, executable file or some intermediate form.
  • the storage medium may include: any entity or device capable of carrying the computer program, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory), a random memory Access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the storage medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example: in some jurisdictions, computer-readable storage Media excludes electrical carrier signals and telecommunication signals.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

本发明提供了一种文本理解方法、系统、终端设备和存储介质,其方法包括:获取用户的会话信息,将所述会话信息转换为待识别文本;通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;根据所述意图类别和关键词,得到所述会话信息对应的用户意图。本发明提高用户意图识别的准确率和效率。

Description

一种文本理解方法、系统、终端设备和存储介质 技术领域
本发明涉及数据分析技术领域,尤指一种文本理解方法、系统、终端设备和存储介质。
背景技术
对话系统(Dialogue System)是一种基于自然语言的人机交互系统。通过对话系统,人可以使用自然语言和计算机进行多轮交互来完成特定的任务,如信息查询、服务获取等。对话系统提供了一种更自然、便捷的人机交互方式,广泛应用于车载、家居、客服等场景。
而人机交互的关键在于对用户的会话信息进行识别理解,主要包括意图识别和关键词提取,现有技术中需要分别构建意图识别模型和关键词提取模型,开发和部署成本上比较高,并且现有技术先进行关键词识别再进行意图识别,这种依次先后通过关键词提取模型和意图识别模型,分别单独进行识别并输出的用户意图的准确率较低,且耗时较长。
发明内容
本发明的目的是提供一种文本理解方法、系统、终端设备和存储介质,实现提高用户意图识别的准确率和效率。
本发明提供的技术方案如下:
本发明提供一种文本理解方法,包括步骤:
获取用户的会话信息,将所述会话信息转换为待识别文本;
通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
进一步的,还包括步骤:
获取短文本语料,并对所述短文本语料进行分类标注和关键词标注;
将标注后的短文本语料划分为训练集、验证集和测试集;
根据所述训练集进行训练生成对应的候选识别模型;
根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型。
进一步的,所述根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型包括步骤:
根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型。
进一步的,所述对所述短文本语料进行分类标注包括步骤:
通过预训练层从所述短文本语料中提取得到对应的词向量;
通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注。
本发明还提供一种文本理解系统,包括:
转换模块,用于获取用户的会话信息,将所述会话信息转换为待识别文本;
识别模块,用于通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
处理模块,用于根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
进一步的,还包括:
语料获取模块,用于获取短文本语料;
分类标注模块,用于对所述短文本语料进行分类标注和关键词标注;
划分模块,用于将标注后的短文本语料划分为训练集、验证集和测试集;
训练模块,用于根据所述训练集进行训练生成对应的候选识别模型;
生成模块,用于根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型。
进一步的,所述生成模块包括:
调整生成单元,用于根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
模型裁剪单元,用于根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
模型建立单元,用于根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型。
进一步的,所述分类标注模块包括:
提取单元,用于通过预训练层从所述短文本语料中提取得到对应的词向量;
分类标注单元,用于通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注。
本发明还提供一种终端设备,包括处理器、存储器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器,用于执行所述存储器上所存放的计算机程序,实现如所述的文本理解方法所执行的操作。
本发明还提供一种存储介质,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行以实现如所述的文本理解方法所执行的操作。
通过本发明提供的一种文本理解方法、系统、终端设备和存储介质,能够提高用户意图识别的准确率和效率。
附图说明
下面将以明确易懂的方式,结合附图说明优选实施方式,对一种文本理解方法、系统、终端设备和存储介质的上述特性、技术特征、优点及其实现方式予以进一步说明。
图1是本发明一种文本理解方法的一个实施例的流程图;
图2是本发明一种文本理解方法的另一个实施例的流程图;
图3是本发明一种文本理解方法的另一个实施例的流程图;
图4是本发明一种文本理解方法的另一个实施例的流程图;
图5是本发明一种文本理解方法的另一个实施例的流程图。
具体实施方式
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其他实施例中也可以实现本申请。在其他情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所述描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其他特征、整体、步骤、操作、元素、组件和/或集合的存在或添加。
为使图面简洁,各图中只示意性地表示出了与本发明相关的部分,它们并不代表其作为产品的实际结构。另外,以使图面简洁便于理解,在有些图中具有相同结构或功能的部件,仅示意性地绘示了其中的一个,或仅标出了其中的一个。在本文中,“一个”不仅表示“仅此一个”,也可以表示“多于一个”的情形。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
另外,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对照附图说明本发明的具体实施方式。显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图,并获得其他的实施方式。
本发明的一个实施例,如图1所示,一种文本理解方法,包括:
S100获取用户的会话信息,将所述会话信息转换为待识别文本;
具体的,本发明适用于用户使用终端设备进行语音人机交互过程,终端设备包括但是不限于家教机、学习机、电脑、智能手机、电话手表、智能台灯、智能耳机等电子产品,以及机器人、无人机、无人车等智能设备。会话信息的内容可以为多种形式的内容,例如可以为文字信息、语音信息等形式的内容。当会话信息为文字形式的信息时,可以直接识别会话信息中的文字内容得到待识别文本。当会话信息为语音形式的信息时,可以对语音形式的会话信息进行语音识别得到待识别文本。
其中,终端设备通过麦克风或者麦克风阵列,采集获取声音信号作为会话信息,然后,终端设备通过语音识别技术从声音信号中,提取用户语音形式的 会话信息并转化得到待识别文本。需要注意的是,终端设备采集获取在语音采集范围内的声音信号,将此声音中提取用户的会话信息,将会话信息转化为待识别文本的具体过程包括:
终端设备提取声音信号的MFCC(Mel-Frequency Cepstral Coefficients,即梅尔频率倒谱系数),将不符合人体声学特征的目标音频片段删除,将删除目标音频片段处理后的声音信号进行解码处理得到对应的词序。然后,终端设备将词序输入到HMM音素模型中得到对应的音素(声母或韵母),根据预设的发音字典将各个音素拼接成文字,将各个文字进行拼接得到待识别文本。
S200通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
其中,目标识别模型是根据同时标注有意图类别和关键词的样本,同时进行训练得到一个识别模型。终端设备将待识别文本输入到目标识别模型,由目标识别模型分别同时输出待识别文本对应的意图类别和关键词。
S300根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
具体的,关键词类型包括动词、名词、量词、数词等等。意图类型包括行为类型意图、查询类型意图以及用户其它意图,用户其它意图是指除行为类型意图、查询类型意图之外的其它意图。行为类型意图包括带有指令性或命令性描述的意图,用户行为意图对应的自然语言一般为命令格式,如:播放音乐、生字学习等,细分包括命令终端设备控制外部设备改变外部设备的状态(包括工作状态和运行状态),或者命令终端设备改变自身状态(包括工作状态和运行状态)的意图。查询类型意图包括带有疑问、疑惑描述的意图,细分包括问题的查询、搜索、询问等等。终端设备通过上述实施例识别得到会话信息对应的意图类别和关键字后,将意图类别和关键字进行组合得到多组候选意图,并将每组候选意图与会话信息进行相似度比对,将相似度最高的候选意图作为会话信息对应的用户意图。
本发明在接收到用户输入的会话信息后,不但要确定会话信息对应的关键词,同时还要确定会话信息对应的意图类型,并根据会话信息对应的关键词和意图类型得到意图识别结果即作为用户意图。本发明通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用户意图识别的准确率。
本发明的一个实施例,如图2所示,一种文本理解方法,包括:
S010获取短文本语料,并对所述短文本语料进行分类标注和关键词标注;
具体的,终端设备收集获取大量的短文本语料后,对短文本语料进行预处理和分词处理。即终端设备首先对短文本语料进行预处理后,对短文本语料进行文本句分割,得到多个文本句。终端设备进而利用预设分词字典对多个文本句进行分词处理,得到多个分词结果。然后,终端设备根据预设的信息标注算法(例如CRF算法即条件随机场算法)对多个分词结果进行标注。终端设备对分词结果进行标注后,对分词结果标注相应的标注序列,即将各短文本语料完成标注的分词结果按照语序顺序连接组合,从而得到多个标注后的短文本语料。
S020将标注后的短文本语料划分为训练集、验证集和测试集;
S030根据所述训练集进行训练生成对应的候选识别模型;
S040根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型;
具体的,终端设备通过上述实施例获取到标注好的短文本语料后,可以随 机抽取一定数量的标注好的短文本语料至不同的集合中,使得训练集、验证集和测试集中标注好的短文本语料的数量,按照7:2:1的比例,或者6:2:2的比例分布。然后,终端设备根据训练集中标注好的短文本语料作为样本数据进行多次迭代训练得到候选识别模型。终端设备再使用测试集和验证集,将训练得到候选识别模型进行至少一次的参数调整,直至参数调整后的候选识别模型的识别准确率达到预设阈值为止,就可以获得最终的目标识别模型。
S100获取用户的会话信息,将所述会话信息转换为待识别文本;
S200通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
S300根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
具体的,本实施例是上述实施例的优化实施例,本实施例中与上述实施例相同的部分参见上述实施例,在此不再一一赘述。
本发明将会话信息转换得到的待识别文本输入已训练的目标识别模型,通过目标识别模型对待识别文本进行意图识别,输出待识别文本对应的意图类别和关键词。具体地,终端设备通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用户意图识别的准确率。
本发明的一个实施例,如图3所示,一种文本理解方法,包括:
S011获取短文本语料,通过预训练层从所述短文本语料中提取得到对应的词向量;
具体的,终端设备获取到大量的短文本语料后,将短文本语料输入至Bert层或者分词器,通过Bert层或者分词器进行提取得到各个短文本语料分别对应的词向量。具体为,终端设备通过Bert层或者分词器对短文本语料进行分词得到分词结果,在获取短文本语料对应的分词结果后,可根据分词结果生成每个分词对应的词向量,进而完成了短文本语料的词向量提取。其中,生成分词对应的词向量的过程可通过现有技术实现,此处不再赘述。
示例性的,假设短文本语料为“帮我爸爸订下周三北京到上海的高铁票”,通过分词器对该短文本语料进行分词得到分词结果,假设用w1,w2,…,wn来表示分词,所获取的分词结果为:w1=帮,w2=我爸爸,w3=订,w4=下周三,w5=北京,w6=到,w7=上海,w8=的,w9=高铁票。在本发明的一个实施例中,在获取短文本语料对应的分词结果后,可根据分词结果生成每个分词对应的词向量。
终端设备训练得到的目标识别模型,根据预先构建的标注有“意图语句-意图类型+关键词”的短文本语料,即每个短文本语料都标注有对应的意图类型+关键词,并且还对应有意图语句,只需将会话信息输入至目标识别模型,并且进行相似度比对,找到与会话信息的意图类型和关键词相似度最高的目标短文本语料,然后通过目标短文本语料可以检索到对应的意图语句就是会话信息对应的用户意图。本发明通过会话语句与短文本语料的意图类型和关键词的匹配,可以识别输出用户意图,提高了用户意图识别的精度,提高了用户意图识别的精确度并降低了人力的消耗和对标注数据的要求。
S012通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注;
具体的,如图4所示,终端设备将短文本语料通过BERT层获取词向量,经过avg_pool层(即本发明的池化层)抽取短文本语料的特征信息后,通过linear层(即本发明的连接层)进行分类,与此同时,终端设备将获取的词向量通过 CRF层(即本发明的标注层)进行词性标注,以便后续根据意图类别和关键词同时同步进行关联训练得到目标识别模型。其中,分词、词性标注属于自然语言处理方法范畴,可以使用诸如LTP、StanfordParser等工具包实现。
本发明在目标识别模型训练阶段,可以将短文本语料的词向量作为待训练的目标识别模型的输入,将该短文本语料对应的用户意图的意图类别和该意图类别下的关键词作为输出,训练得到目标识别模型的参数信息,也即得到训练好的目标识别模型。
S020将标注后的短文本语料划分为训练集、验证集和测试集;
S030根据所述训练集进行训练生成对应的候选识别模型;
S040根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型;
S100获取用户的会话信息,将所述会话信息转换为待识别文本;
S200通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
S300根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
本发明将会话信息转换得到的待识别文本输入已训练的目标识别模型,通过目标识别模型对待识别文本进行意图识别,输出待识别文本对应的意图类别和关键词。具体地,终端设备通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用户意图识别的准确率。
本发明的一个实施例,如图5所示,一种文本理解方法,包括:
S011获取短文本语料,通过预训练层从所述短文本语料中提取得到对应的词向量;
S012通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注;
S020将标注后的短文本语料划分为训练集、验证集和测试集;
S030根据所述训练集进行训练生成对应的候选识别模型;
S041根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
具体的,训练集用来估计模型,验证集用来确定网络结构或者控制模型复杂程度的参数,而测试集则检验最终选择最优的模型的性能如何。终端设备通过上述实施例划分得到训练集、验证集和测试集后,就使用训练集进行训练生成对应的候选识别模型。然后,终端设备根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型。
S042根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
具体的,在深度学习的背景下,为了达到更好的预测,常常使用过参数化的深度神经网络或者集成模型(将许多弱的模型集成起来),往往可以实现较好的预测。但是,不论是过参数化还是集成模型需要的计算量和计算资源很大,对部署非常不利。深度学习在计算机视觉、语音识别、自然语言处理等众多领域取得了令人难以置信的成绩。然而,这些模型中的大多数在移动电话或嵌入式设备上运行的计算成本太过昂贵。知识蒸馏指的是模型压缩的思想,通过一步一步地使用一个较大的已经训练好的网络去教导一个较小的网络确切地去做什么。
因此,本发明根据训练集、验证集和测试集,训练得到的目标参数模型的计算量和计算资源很大。因此,本发明先训练一个大而强的待定识别模型,然 后将待定识别模型其包含的知识转移给小的候选识别模型,就完成了待识别模型的压缩裁减。具体为,终端设备通过引入与教师网络(即待定识别模型)相关的软目标作为整体损失的一部分,并且建立学生网络(即候选识别网络)的中间输出与教师网络的对应关系,这种对应关系可以直接将教师网络中某一层的输出信息传递给学生网络,以诱导学生网络的训练实现知识迁移。
S043根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型;
具体的,终端设备通过上述方式迁移学习得到候选识别模型后,根据待定识别模型对所述测试集的验证结果对所述候选识别模型进行参数调整(为了便于叙述,下文简称为第一参数调整),并且根据所述测试集中的短文本语料对所述候选识别模型进行参数调整(为了便于叙述,下文简称为第二参数调整),并且,终端设备设置第一参数调整的第一权重比例,以及第二参数调整的第二权重比例,第一权重比例和第二权重比例的和值为1,使得终端设备根据验证结果以及测试集中的短文本语料,结合对所述候选识别模型进行参数调整进而生成所述目标识别模型。
需要注意的是,终端设备根据待定识别模型对所述测试集的验证结果的准确率,适应性调整第一权重比例和第二权重比例的占比大小,例如,如果根据待定识别模型对所述测试集的验证结果的准确率大于预设数值,那么第二权重比例大于第一权重比例。如果根据待定识别模型对所述测试集的验证结果的准确率小于预设数值,那么第二权重比例小于第一权重比例。
S100获取用户的会话信息,将所述会话信息转换为待识别文本;
S200通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
S300根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
本发明共用BERT层向量,并且根据具体模型效果对BERT层进行裁剪,达到 降低训练时间和模型大小的效果。短文本意图和关键词融合训练,较少训练时间,同时增加整体准确率,减少耗时。大大减少了识别用户意图的神经网络模型的训练时间,并且通过知识蒸馏算法压缩裁减,能够有效地减小的识别用户意图的神经网络模型即目标识别模型的大小的同时,可同时获取意图和关键词,以便提升用户意图识别的准确率。
本发明的一个实施例,一种文本理解系统,包括:
转换模块,用于获取用户的会话信息,将所述会话信息转换为待识别文本;
具体的,本发明适用于用户使用终端设备进行语音人机交互过程,终端设备包括但是不限于家教机、学习机、电脑、智能手机、电话手表、智能台灯、智能耳机等电子产品,以及机器人、无人机、无人车等智能设备。会话信息的内容可以为多种形式的内容,例如可以为文字信息、语音信息等形式的内容。当会话信息为文字形式的信息时,可以直接识别会话信息中的文字内容得到待识别文本。当会话信息为语音形式的信息时,可以对语音形式的会话信息进行语音识别得到待识别文本。
其中,终端设备通过麦克风或者麦克风阵列,采集获取声音信号作为会话信息,然后,终端设备通过语音识别技术从声音信号中,提取用户语音形式的会话信息并转化得到待识别文本。需要注意的是,终端设备采集获取在语音采集范围内的声音信号,将此声音中提取用户的会话信息,将会话信息转化为待识别文本的具体过程包括:
终端设备提取声音信号的MFCC(Mel-Frequency Cepstral Coefficients,即梅尔频率倒谱系数),将不符合人体声学特征的目标音频片段删除,将删除目标音频片段处理后的声音信号进行解码处理得到对应的词序。然后,终端设备将词序输入到HMM音素模型中得到对应的音素(声母或韵母),根据预设的发音字典将各个音素拼接成文字,将各个文字进行拼接得到待识别文本。
识别模块,用于通过目标识别模型从所述待识别文本中,分别同时输出对 应的意图类别和关键词;
其中,目标识别模型是根据同时标注有意图类别和关键词的样本,同时进行训练得到一个识别模型。终端设备将待识别文本输入到目标识别模型,由目标识别模型分别同时输出待识别文本对应的意图类别和关键词。
处理模块,用于根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
具体的,关键词类型包括动词、名词、量词、数词等等。意图类型包括行为类型意图、查询类型意图以及用户其它意图,用户其它意图是指除行为类型意图、查询类型意图之外的其它意图。行为类型意图包括带有指令性或命令性描述的意图,用户行为意图对应的自然语言一般为命令格式,如:播放音乐、生字学习等,细分包括命令终端设备控制外部设备改变外部设备的状态(包括工作状态和运行状态),或者命令终端设备改变自身状态(包括工作状态和运行状态)的意图。查询类型意图包括带有疑问、疑惑描述的意图,细分包括问题的查询、搜索、询问等等。终端设备通过上述实施例识别得到会话信息对应的意图类别和关键字后,将意图类别和关键字进行组合得到多组候选意图,并将每组候选意图与会话信息进行相似度比对,将相似度最高的候选意图作为会话信息对应的用户意图。
本发明在接收到用户输入的会话信息后,不但要确定会话信息对应的关键词,同时还要确定会话信息对应的意图类型,并根据会话信息对应的关键词和意图类型得到意图识别结果即作为用户意图。本发明通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关 键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用户意图识别的准确率。
基于前述实施例,还包括:
语料获取模块,用于获取短文本语料;
具体的,终端设备收集获取大量的短文本语料后,对短文本语料进行预处理和分词处理。即终端设备首先对短文本语料进行预处理后,对短文本语料进行文本句分割,得到多个文本句。终端设备进而利用预设分词字典对多个文本句进行分词处理,得到多个分词结果。然后,终端设备根据预设的信息标注算法(例如CRF算法即条件随机场算法)对多个分词结果进行标注。终端设备对分词结果进行标注后,对分词结果标注相应的标注序列,即将各短文本语料完成标注的分词结果按照语序顺序连接组合,从而得到多个标注后的短文本语料。
分类标注模块,用于对所述短文本语料进行分类标注和关键词标注;
划分模块,用于将标注后的短文本语料划分为训练集、验证集和测试集;
训练模块,用于根据所述训练集进行训练生成对应的候选识别模型;
生成模块,用于根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型。
具体的,终端设备通过上述实施例获取到标注好的短文本语料后,可以随机抽取一定数量的标注好的短文本语料至不同的集合中,使得训练集、验证集和测试集中标注好的短文本语料的数量,按照7:2:1的比例,或者6:2:2的比例分布。然后,终端设备根据训练集中标注好的短文本语料作为样本数据进行多次迭代训练得到候选识别模型。终端设备再使用测试集和验证集,将训练得到候选识别模型进行至少一次的参数调整,直至参数调整后的候选识别模型的识别准确率达到预设阈值为止,就可以获得最终的目标识别模型。
本发明将会话信息转换得到的待识别文本输入已训练的目标识别模型,通 过目标识别模型对待识别文本进行意图识别,输出待识别文本对应的意图类别和关键词。具体地,终端设备通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用户意图识别的准确率。
基于前述实施例,所述生成模块包括:
调整生成单元,用于根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
具体的,训练集用来估计模型,验证集用来确定网络结构或者控制模型复杂程度的参数,而测试集则检验最终选择最优的模型的性能如何。终端设备通过上述实施例划分得到训练集、验证集和测试集后,就使用训练集进行训练生成对应的候选识别模型。然后,终端设备根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型。
模型裁剪单元,用于根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
具体的,在深度学习的背景下,为了达到更好的预测,常常使用过参数化的深度神经网络或者集成模型(将许多弱的模型集成起来),往往可以实现较好的预测。但是,不论是过参数化还是集成模型需要的计算量和计算资源很大,对部署非常不利。深度学习在计算机视觉、语音识别、自然语言处理等众多领域取得了令人难以置信的成绩。然而,这些模型中的大多数在移动电话或嵌入式设备上运行的计算成本太过昂贵。知识蒸馏指的是模型压缩的思想,通过一 步一步地使用一个较大的已经训练好的网络去教导一个较小的网络确切地去做什么。
因此,本发明根据训练集、验证集和测试集,训练得到的目标参数模型的计算量和计算资源很大。因此,本发明先训练一个大而强的待定识别模型,然后将待定识别模型其包含的知识转移给小的候选识别模型,就完成了待识别模型的压缩裁减。具体为,终端设备通过引入与教师网络(即待定识别模型)相关的软目标作为整体损失的一部分,并且建立学生网络(即候选识别网络)的中间输出与教师网络的对应关系,这种对应关系可以直接将教师网络中某一层的输出信息传递给学生网络,以诱导学生网络的训练实现知识迁移。
模型建立单元,用于根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型。
具体的,终端设备通过上述方式迁移学习得到候选识别模型后,根据待定识别模型对所述测试集的验证结果对所述候选识别模型进行参数调整(为了便于叙述,下文简称为第一参数调整),并且根据所述测试集中的短文本语料对所述候选识别模型进行参数调整(为了便于叙述,下文简称为第二参数调整),并且,终端设备设置第一参数调整的第一权重比例,以及第二参数调整的第二权重比例,第一权重比例和第二权重比例的和值为1,使得终端设备根据验证结果以及测试集中的短文本语料,结合对所述候选识别模型进行参数调整进而生成所述目标识别模型。
需要注意的是,终端设备根据待定识别模型对所述测试集的验证结果的准确率,适应性调整第一权重比例和第二权重比例的占比大小,例如,如果根据待定识别模型对所述测试集的验证结果的准确率大于预设数值,那么第二权重比例大于第一权重比例。如果根据待定识别模型对所述测试集的验证结果的准确率小于预设数值,那么第二权重比例小于第一权重比例。
本发明共用BERT层向量,并且根据具体模型效果对BERT层进行裁剪,达到降低训练时间和模型大小的效果。短文本意图和关键词融合训练,较少训练时间,同时增加整体准确率,减少耗时。大大减少了识别用户意图的神经网络模型的训练时间,并且通过知识蒸馏算法压缩裁减,能够有效地减小的识别用户意图的神经网络模型即目标识别模型的大小的同时,可同时获取意图和关键词,以便提升用户意图识别的准确率。
基于前述实施例,所述分类标注模块包括:
提取单元,用于通过预训练层从所述短文本语料中提取得到对应的词向量;
具体的,终端设备获取到大量的短文本语料后,将短文本语料输入至Bert层或者分词器,通过Bert层或者分词器进行提取得到各个短文本语料分别对应的词向量。具体为,终端设备通过Bert层或者分词器对短文本语料进行分词得到分词结果,在获取短文本语料对应的分词结果后,可根据分词结果生成每个分词对应的词向量,进而完成了短文本语料的词向量提取。其中,生成分词对应的词向量的过程可通过现有技术实现,此处不再赘述。
示例性的,假设短文本语料为“帮我爸爸订下周三北京到上海的高铁票”,通过分词器对该短文本语料进行分词得到分词结果,假设用w1,w2,…,wn来表示分词,所获取的分词结果为:w1=帮,w2=我爸爸,w3=订,w4=下周三,w5=北京,w6=到,w7=上海,w8=的,w9=高铁票。在本发明的一个实施例中,在获取短文本语料对应的分词结果后,可根据分词结果生成每个分词对应的词向量。
终端设备训练得到的目标识别模型,根据预先构建的标注有“意图语句-意图类型+关键词”的短文本语料,即每个短文本语料都标注有对应的意图类型+关键词,并且还对应有意图语句,只需将会话信息输入至目标识别模型,并且进行相似度比对,找到与会话信息的意图类型和关键词相似度最高的目标 短文本语料,然后通过目标短文本语料可以检索到对应的意图语句就是会话信息对应的用户意图。本发明通过会话语句与短文本语料的意图类型和关键词的匹配,可以识别输出用户意图,提高了用户意图识别的精度,提高了用户意图识别的精确度并降低了人力的消耗和对标注数据的要求。
分类标注单元,用于通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注。
具体的,如图4所示,终端设备将短文本语料通过BERT层获取词向量,经过avg_pool层(即本发明的池化层)抽取短文本语料的特征信息后,通过linear层(即本发明的连接层)进行分类,与此同时,终端设备将获取的词向量通过CRF层(即本发明的标注层)进行词性标注,以便后续根据意图类别和关键词同时同步进行关联训练得到目标识别模型。其中,分词、词性标注属于自然语言处理方法范畴,可以使用诸如LTP、StanfordParser等工具包实现。
本发明在目标识别模型训练阶段,可以将短文本语料的词向量作为待训练的目标识别模型的输入,将该短文本语料对应的用户意图的意图类别和该意图类别下的关键词作为输出,训练得到目标识别模型的参数信息,也即得到训练好的目标识别模型。
本发明将会话信息转换得到的待识别文本输入已训练的目标识别模型,通过目标识别模型对待识别文本进行意图识别,输出待识别文本对应的意图类别和关键词。具体地,终端设备通过目标识别模型同时识别输出会话信息对应的关键词及其意图类型,不需要等待关键词识别结果后,再根据关键词进行识别得到用户的意图,也就是说,本发明不需要依次先后识别获取会话信息对应的关键词及其意图类型,同时并行输出关键词和意图类型的方式,能够减少先后等待识别的时间,进而可以大大提高用户意图识别的效率。另外,这种同时并行输出关键词和意图类型的方式,使得会话信息中的关键词和意图类型具有关联性,进而能够准确有效地识别出会话信息所对应的用户意图,大大提升了用 户意图识别的准确率。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的程序模块完成,即将所述装置的内部结构划分成不同的程序单元或模块,以完成以上描述的全部或者部分功能。实施例中的各程序模块可以集成在一个处理单元中,也可是各个单元单独物理存在,也可以两个或两个以上单元集成在一个处理单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序单元的形式实现。另外,各程序模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。
本发明的一个实施例,一种终端设备,包括处理器、存储器,其中,存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的计算机程序,实现上述所对应方法实施例中的文本理解方法。
所述终端设备可以为桌上型计算机、笔记本、掌上电脑、平板型计算机、手机、人机交互屏等设备。所述终端设备可包括,但不仅限于处理器、存储器。本领域技术人员可以理解,上述仅仅是终端设备的示例,并不构成对终端设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如:终端设备还可以包括输入/输出接口、显示设备、网络接入设备、通信总线、通信接口等。通信接口和通信总线,还可以包括输入/输出接口,其中,处理器、存储器、输入/输出接口和通信接口通过通信总线完成相互间的通信。该存储器存储有计算机程序,该处理器用于执行存储器上所存放的计算机程序,实现上述所对应方法实施例中的文本理解方法。
所述处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、 现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
所述存储器可以是所述终端设备的内部存储单元,例如:终端设备的硬盘或内存。所述存储器也可以是所述终端设备的外部存储设备,例如:所述终端设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器还可以既包括所述终端设备的内部存储单元也包括外部存储设备。所述存储器用于存储所述计算机程序以及所述终端设备所需要的其他程序和数据。所述存储器还可以用于暂时地存储已经输出或者将要输出的数据。
通信总线是连接所描述的元素的电路并且在这些元素之间实现传输。例如,处理器通过通信总线从其它元素接收到命令,解密接收到的命令,根据解密的命令执行计算或数据处理。存储器可以包括程序模块,例如内核(kernel),中间件(middleware),应用程序编程接口(Application Programming Interface,API)和应用。该程序模块可以是有软件、固件或硬件、或其中的至少两种组成。输入/输出接口转发用户通过输入/输出接口(例如感应器、键盘、触摸屏)输入的命令或数据。通信接口将该终端设备与其它网络设备、用户设备、网络进行连接。例如,通信接口可以通过有线或无线连接到网络以连接到外部其它的网络设备或用户设备。无线通信可以包括以下至少一种:无线保真(WiFi),蓝牙(BT),近距离无线通信技术(NFC),全球卫星定位系统(GPS)和蜂窝通信等等。有线通信可以包括以下至少一种:通用串行总线(USB),高清晰度多媒体接口(HDMI),异步传输标准接口(RS-232)等等。网络可以是电信网络和通信网络。通信网络可以为计算机网络、因特网、物联网、电话网络。终端设备可以通过通信接口连接网络,终端设备和其它网络设备通信所用的协议可以被应用、应 用程序编程接口(API)、中间件、内核和通信接口至少一个支持。
本发明的一个实施例,一种存储介质,存储介质中存储有至少一条指令,指令由处理器加载并执行以实现上述文本理解方法对应实施例所执行的操作。例如,存储介质可以是只读内存(ROM)、随机存取存储器(RAM)、只读光盘(CD-ROM)、磁带、软盘和光数据存储设备等。
它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详细描述或记载的部分,可以参见其他实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其他的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性、机械或其他的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可能集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序发送指令给相关的硬件完成,所述的计算机程序可存储于一存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述存储介质可以包括:能够携带所述计算机程序的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如:在某些司法管辖区,根据立法和专利实践,计算机可读的存储介质不包括电载波信号和电信信号。
应当说明的是,上述实施例均可根据需要自由组合。以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。

Claims (10)

  1. 一种文本理解方法,其特征在于,包括步骤:
    获取用户的会话信息,将所述会话信息转换为待识别文本;
    通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
    根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
  2. 根据权利要求1所述的文本理解方法,其特征在于,还包括步骤:
    获取短文本语料,并对所述短文本语料进行分类标注和关键词标注;
    将标注后的短文本语料划分为训练集、验证集和测试集;
    根据所述训练集进行训练生成对应的候选识别模型;
    根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型。
  3. 根据权利要求2所述的文本理解方法,其特征在于,所述根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型包括步骤:
    根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
    根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
    根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型。
  4. 根据权利要求2所述的文本理解方法,其特征在于,所述对所述短文本语料进行分类标注包括步骤:
    通过预训练层从所述短文本语料中提取得到对应的词向量;
    通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注。
  5. 一种文本理解系统,其特征在于,包括:
    转换模块,用于获取用户的会话信息,将所述会话信息转换为待识别文本;
    识别模块,用于通过目标识别模型从所述待识别文本中,分别同时输出对应的意图类别和关键词;
    处理模块,用于根据所述意图类别和关键词,得到所述会话信息对应的用户意图。
  6. 根据权利要求5所述的文本理解系统,其特征在于,还包括:
    语料获取模块,用于获取短文本语料;
    分类标注模块,用于对所述短文本语料进行分类标注和关键词标注;
    划分模块,用于将标注后的短文本语料划分为训练集、验证集和测试集;
    训练模块,用于根据所述训练集进行训练生成对应的候选识别模型;
    生成模块,用于根据所述测试集和验证集,对所述候选识别模型进行参数调整,生成所述目标识别模型。
  7. 根据权利要求6所述的文本理解系统,其特征在于,所述生成模块包括:
    调整生成单元,用于根据所述验证集对所述候选识别模型进行参数调整,生成对应的待定识别模型;
    模型裁剪单元,用于根据知识蒸馏算法将所述待定识别模型进行裁剪得到候选识别模型;
    模型建立单元,用于根据待定识别模型对所述测试集的验证结果,以及所述测试集中的短文本语料,对所述候选识别模型进行参数调整,生成所述目标识别模型。
  8. 根据权利要求6所述的文本理解系统,其特征在于,所述分类标注模块包括:
    提取单元,用于通过预训练层从所述短文本语料中提取得到对应的词向量;
    分类标注单元,用于通过池化层抽取所述词向量的特征信息后由连接层进行意图分类标注,同时通过标注层对所述词向量进行词性标注。
  9. 一种终端设备,其特征在于,包括处理器、存储器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器,用于执行所述存储器上所存放的计算机程序,实现如权利要求1至权利要求4任一项所述的文本理解方法所执行的操作。
  10. 一种存储介质,其特征在于,所述存储介质中存储有至少一条指令,所述指令由处理器加载并执行以实现如权利要求1至权利要求4任一项所述的文本理解方法所执行的操作。
PCT/CN2021/103714 2021-06-30 2021-06-30 一种文本理解方法、系统、终端设备和存储介质 WO2023272616A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/103714 WO2023272616A1 (zh) 2021-06-30 2021-06-30 一种文本理解方法、系统、终端设备和存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/103714 WO2023272616A1 (zh) 2021-06-30 2021-06-30 一种文本理解方法、系统、终端设备和存储介质

Publications (1)

Publication Number Publication Date
WO2023272616A1 true WO2023272616A1 (zh) 2023-01-05

Family

ID=84692101

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/103714 WO2023272616A1 (zh) 2021-06-30 2021-06-30 一种文本理解方法、系统、终端设备和存储介质

Country Status (1)

Country Link
WO (1) WO2023272616A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116108373A (zh) * 2023-04-17 2023-05-12 京东科技信息技术有限公司 话单数据分类标注系统、电子设备及存储介质
CN116911314A (zh) * 2023-09-13 2023-10-20 北京中关村科金技术有限公司 意图识别模型的训练方法、会话意图识别方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413746A (zh) * 2019-06-25 2019-11-05 阿里巴巴集团控股有限公司 对用户问题进行意图识别的方法及装置
CN111339745A (zh) * 2020-03-06 2020-06-26 京东方科技集团股份有限公司 一种随访报告生成方法、设备、电子设备和存储介质
US20200242302A1 (en) * 2019-01-29 2020-07-30 Ricoh Company, Ltd. Intention identification method, intention identification apparatus, and computer-readable recording medium
CN111651600A (zh) * 2020-06-02 2020-09-11 携程计算机技术(上海)有限公司 语句多意图识别方法、系统、电子设备及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200242302A1 (en) * 2019-01-29 2020-07-30 Ricoh Company, Ltd. Intention identification method, intention identification apparatus, and computer-readable recording medium
CN110413746A (zh) * 2019-06-25 2019-11-05 阿里巴巴集团控股有限公司 对用户问题进行意图识别的方法及装置
CN111339745A (zh) * 2020-03-06 2020-06-26 京东方科技集团股份有限公司 一种随访报告生成方法、设备、电子设备和存储介质
CN111651600A (zh) * 2020-06-02 2020-09-11 携程计算机技术(上海)有限公司 语句多意图识别方法、系统、电子设备及存储介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116108373A (zh) * 2023-04-17 2023-05-12 京东科技信息技术有限公司 话单数据分类标注系统、电子设备及存储介质
CN116911314A (zh) * 2023-09-13 2023-10-20 北京中关村科金技术有限公司 意图识别模型的训练方法、会话意图识别方法及系统
CN116911314B (zh) * 2023-09-13 2023-12-19 北京中关村科金技术有限公司 意图识别模型的训练方法、会话意图识别方法及系统

Similar Documents

Publication Publication Date Title
US20200258506A1 (en) Domain and intent name feature identification and processing
CN111933129B (zh) 音频处理方法、语言模型的训练方法、装置及计算机设备
WO2022057712A1 (zh) 电子设备及其语义解析方法、介质和人机对话系统
WO2021051544A1 (zh) 语音识别方法及其装置
CN103700370B (zh) 一种广播电视语音识别系统方法及系统
WO2020043123A1 (zh) 命名实体识别方法、命名实体识别装置、设备及介质
CN103280216B (zh) 改进依赖上下文的语音识别器对环境变化的鲁棒性
WO2021147041A1 (zh) 语义分析方法、装置、设备及存储介质
US20200058300A1 (en) Proactive command framework
US20240021202A1 (en) Method and apparatus for recognizing voice, electronic device and medium
KR20170034227A (ko) 음성 인식 장치 및 방법과, 음성 인식을 위한 변환 파라미터 학습 장치 및 방법
US20080294433A1 (en) Automatic Text-Speech Mapping Tool
WO2023272616A1 (zh) 一种文本理解方法、系统、终端设备和存储介质
WO2020238045A1 (zh) 智能语音识别方法、装置及计算机可读存储介质
WO2021063089A1 (zh) 规则匹配方法、规则匹配装置、存储介质及电子设备
US20190303393A1 (en) Search method and electronic device using the method
CN112669842A (zh) 人机对话控制方法、装置、计算机设备及存储介质
CN111144102A (zh) 用于识别语句中实体的方法、装置和电子设备
CN113486661A (zh) 一种文本理解方法、系统、终端设备和存储介质
CN111126084B (zh) 数据处理方法、装置、电子设备和存储介质
CN110503956B (zh) 语音识别方法、装置、介质及电子设备
CN111354354B (zh) 一种基于语义识别的训练方法、训练装置及终端设备
CN110827799A (zh) 用于处理语音信号的方法、装置、设备和介质
CN111444321A (zh) 问答方法、装置、电子设备和存储介质
WO2019228140A1 (zh) 指令执行方法、装置、存储介质及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21947570

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE