WO2020248366A1 - 文本意图智能分类方法、装置及计算机可读存储介质 - Google Patents

文本意图智能分类方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2020248366A1
WO2020248366A1 PCT/CN2019/102207 CN2019102207W WO2020248366A1 WO 2020248366 A1 WO2020248366 A1 WO 2020248366A1 CN 2019102207 W CN2019102207 W CN 2019102207W WO 2020248366 A1 WO2020248366 A1 WO 2020248366A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
training
layer
intention
intent
Prior art date
Application number
PCT/CN2019/102207
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 平安科技(深圳)有限公司
Publication of WO2020248366A1 publication Critical patent/WO2020248366A1/zh

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/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • 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

Definitions

  • This application relates to the field of artificial intelligence technology, and in particular to a method, device and computer-readable storage medium for intelligent text intent classification.
  • intelligent answering systems have become popular to a certain extent.
  • the current intelligent answering system generally uses keyword rules or simple search to match the answers to answer customer questions.
  • Such answering methods often answer the wrong questions and are not intelligent enough, so they cannot solve the problems raised by customers well, which is wasteful.
  • the client's time also wasted the server's computing resources, and it did not achieve the original intention of reducing the pressure of manual customer service.
  • this application provides a method, device and computer-readable storage medium for intelligent classification of text intentions. Its purpose is to judge the intention of the text input by the user and output the judgment result when the user inputs text data.
  • this application provides a method for intelligently classifying text intentions, which includes:
  • Step A Receive an original text set and a tag set, and remove stop words and punctuation marks from the original text set to obtain a primary text set;
  • Step B Convert the primary text set into a word vector text set, and classify the word vector text set into a training set and a test set;
  • Step C Input the training set and the label set into the pre-built intention recognition model for training, and exit the training until the intention recognition model meets the preset training requirements;
  • Step D Input the test set into the intent recognition model for text intent judgment, and calculate the matching accuracy rate of the judgment result of the text intent with the content in the label set, if the matching accuracy rate is less than a preset Accuracy rate, return to step C, if the matching accuracy rate is greater than the preset accuracy rate, the intention recognition model completes the training;
  • Step E Receive the user's text, convert the text into word vector text and input it into the intention recognition model for text intention judgment, and output the judgment result.
  • this application also provides a text intent intelligent classification device, the device includes a memory and a processor, the memory stores a text intent intelligent classification program that can be run on the processor, so The intelligent classification program of the text intention is executed by the processor, and the following steps can be realized:
  • Step A Receive an original text set and a tag set, and remove stop words and punctuation marks from the original text set to obtain a primary text set;
  • Step B Input the primary text set into the word vectorization conversion model to obtain a word vector text set, and classify the word vector text set into a training set and a test set;
  • Step C Input the training set and the label set into the intention recognition model for training, and exit the training until the intention recognition model meets the training requirements;
  • Step D Input the test set into the intention recognition model for text intention judgment, calculate whether the text intention judgment is the same as the content in the label set, and obtain the judgment accuracy rate. If the judgment accuracy rate is less than a preset Accuracy rate, return to step C, if the judgment accuracy rate is greater than the preset accuracy rate, the intention recognition model completes the training;
  • Step E Receive the user's text A, and convert the text A into word vector text A, input it to the intention recognition model for text intention judgment, and output the judgment result.
  • the present application also provides a computer-readable storage medium, the computer-readable storage medium includes a text intent intelligent classification program, when the text intent intelligent classification program is executed by a processor, the above Any step in the method for intelligent classification of text intentions.
  • This application can effectively improve the collection of text features and increase the accuracy of text classification by converting the primary text set into a word vector text set.
  • the intention recognition model is based on deep learning, which can effectively recognize the text features.
  • Text keywords are generated and intent classification is performed based on the keywords. Therefore, the method, device, and computer-readable storage medium for intelligent classification of text intents proposed in this application can realize accurate intelligent classification of text intents.
  • FIG. 1 is a schematic flowchart of a method for intelligent classification of text intents provided by an embodiment of this application;
  • FIG. 2 is a schematic diagram of the internal structure of a text intention intelligent classification device provided by an embodiment of the application;
  • FIG. 3 is a schematic diagram of modules of a text intent intelligent classification program in a text intent intelligent classification device provided by an embodiment of the application.
  • This application provides an intelligent classification method for text intent.
  • FIG. 1 it is a schematic flowchart of a method for intelligently classifying text intentions according to 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 method for intelligently classifying text intent includes:
  • S1 Receive an original text set and a tag set, and remove stop words and punctuation marks from the original text set to obtain a primary text set.
  • the original text set includes various questions recorded in words, such as question A: "When will the shipment be shipped?" Question B: “Why is there no logistics information?" Question C: “Will the Double Eleven “Price reduction”, Question D: “Will the price change in the near future?” and other issues.
  • the tag set records the classification results of various questions in the original text set, such as question A: “when will the shipment” and question B: “why there is no logistics information” are recorded in the tag set as “Delivery consultation”; Question C: “Will the double eleven price drop” and Question D: “Will the price change in the near future?” are recorded as "price change consultation” in the label set.
  • the stop words include that, this, oops, such as, bar, but, etc., and the punctuation includes a period, a comma, and hello.
  • this application makes a Chinese stop word list and a Chinese punctuation mark table, and compares whether the original text set has the same part with the Chinese stop word list and the Chinese punctuation mark table to remove the stop The purpose of the word and said punctuation. For example, question D: "Will the price change in the near future?" After removing the stop word and the punctuation mark, it becomes: "The price changes in the near future".
  • a word vectorization conversion model is used to convert the primary text set into a word vector text set, and the word vectorization conversion model includes an input layer, a projection layer, and an output layer.
  • the preferred embodiment of the present application inputs the primary text set to the input layer, and the input layer determines the appearance position of each word ⁇ in the primary text set in the primary text set Context( ⁇ ), and input the appearance position Context( ⁇ ) to the projection layer.
  • 4), Context( ⁇ 2 ) p(2
  • the projection layer performs an accumulation summation operation based on the appearance position Context( ⁇ ) to obtain an accumulation summation matrix X ⁇ , and establishes a probability model according to the X ⁇ .
  • the cumulative summation operation to obtain the cumulative summation matrix X ⁇ is:
  • V(Context( ⁇ i )) is the matrix representation form of the appearance position Context( ⁇ ), c represents the number of words in each text of the primary text set, such as the number of words in the “recent price change” Is 4.
  • the probability model is:
  • Context is the primary text set
  • is each word in the primary text set
  • the Huffman coding uses different arrangements of 0 and 1 codes to represent words according to data communication knowledge. The words are called leaf nodes, and the weight of each leaf node is expressed by Huffman coding.
  • the output layer establishes a log-likelihood function according to the probability model, and maximizes the log-likelihood function to obtain a word vector text set, and the log-likelihood function ⁇ is:
  • is the log likelihood function
  • the log likelihood function ⁇ can be further expanded based on the probability model to:
  • l ⁇ represents the number of nodes included in the path p ⁇
  • is a threshold function
  • the threshold function may be a sigmoid function
  • the method for maximizing the log likelihood function is:
  • the optimized probability model is obtained, and the optimized cumulative sum matrix X ⁇ is obtained based on the optimized probability model. Further, the word vector is obtained based on the optimized cumulative sum matrix X ⁇ , so the primary text set Can be transformed into word vector text set.
  • the word vector text set is randomly divided into training set and test set according to the number of 8:2.
  • the intention recognition model includes a convolutional neural network
  • the convolutional neural network has sixteen convolutional layers, sixteen pooling layers, and one fully connected layer.
  • the convolutional neural network receives the training set, it inputs the training set to the first layer of convolutional layer, and the first layer of convolutional layer performs convolution operation to obtain the first convolutional data set and input to The first pooling layer;
  • the first pooling layer performs a maximization pooling operation on the first convolutional data set to obtain the first dimensionality reduction data set and input it to the second convolutional layer;
  • the two-layer convolutional layer performs the convolution operation again to obtain the second convolutional data set and input to the second-layer pooling layer to perform the maximization pooling operation to obtain the second dimensionality reduction data set, and so on, until the final Obtain the sixteenth dimensionality reduction data set, and input the sixteenth dimensionality reduction data set to the fully connected layer.
  • the fully connected layer receives the sixteenth dimensionality reduction data set, calculates the training value set in combination with an activation function, and inputs the training value set and the label set to the intention recognition
  • the loss function calculates a loss value, and judges the magnitude relationship between the loss value and a preset training threshold, until the loss value is less than the preset training threshold, the intention recognition model exits training
  • the preset training threshold is generally set to 0.1.
  • ⁇ ' is output data
  • is input data
  • k is the size of the convolution kernel of the convolution layer
  • s is the stride of the convolution operation
  • p is the data zero-filling matrix
  • the activation function is:
  • n is the size of the label set
  • y t is the training value set
  • ⁇ t is the label set.
  • step S4 includes:
  • the intent recognition model obtains the intent classification set of the test set after performing the above convolution operation, pooling operation, and activation operation based on the test set, and sequentially compares whether the intent classification set and the label set are the same, and Calculate the same number, and divide the same number by the total number of test sets to obtain the accuracy rate.
  • the intention recognition model judges "recent price changes” in the test set as “price change consultation", which is consistent with the actual classification as “price change consultation”, so the judgment of the intention recognition model is correct.
  • the accuracy rate is generally set to 95%, and when the accuracy rate is less than 95%, return to S3 to continue training.
  • This application provides an intelligent classification device for text intent.
  • FIG. 2 it is a schematic diagram of the internal structure of a text intention intelligent classification device provided by an embodiment of this application.
  • the text intent intelligent classification device 1 may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, or a portable computer, or a server.
  • the text intention intelligent classification 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 text intent intelligent classification device 1, for example, the hard disk of the text intent intelligent classification device 1.
  • the memory 11 may also be an external storage device of the text intent intelligent classification device 1, for example, a plug-in hard disk equipped on the text intent intelligent classification device 1, a smart media card (SMC), and a secure digital (Secure Digital, SD) card, flash card (Flash Card), etc.
  • the memory 11 may also include both the internal storage unit of the text intent intelligent classification device 1 and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed in the text intent intelligent classification device 1, such as the code of the text intent intelligent classification 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, and is used to run the program code or processing stored in the memory 11 Data, such as the implementation of the text intention intelligent classification program 01, etc.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip
  • 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-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the text intention intelligent classification device 1 and to display a visualized user interface.
  • Figure 2 only shows the text intent intelligent classification device 1 with components 11-14 and the text intent intelligent classification program 01. Those skilled in the art can understand that the structure shown in Figure 1 does not constitute a text intent intelligent classification device
  • the definition of 1 may include fewer or more components than shown, or a combination of certain components, or different component arrangements.
  • the memory 11 stores the text intent intelligent classification program 01; when the processor 12 executes the text intent intelligent classification program 01 stored in the memory 11, the following steps are implemented:
  • Step 1 Receive an original text set and a tag set, and remove stop words and punctuation from the original text set to obtain a primary text set.
  • the original text set includes various questions recorded in words, such as question A: "When will the shipment be shipped?" Question B: “Why is there no logistics information?" Question C: “Will the Double Eleven “Price reduction”, Question D: “Will the price change in the near future?” and other issues.
  • the tag set records the classification results of various questions in the original text set, such as question A: “when will the shipment” and question B: “why there is no logistics information” are recorded in the tag set as “Delivery consultation”; Question C: “Will the double eleven price drop” and Question D: “Will the price change in the near future?” are recorded as "price change consultation” in the label set.
  • the stop words include that, this, oops, such as, bar, but, etc., and the punctuation includes a period, a comma, and hello.
  • this application makes a Chinese stop word list and a Chinese punctuation mark table, and compares whether the original text set has the same part with the Chinese stop word list and the Chinese punctuation mark table to remove the stop The purpose of the word and said punctuation. For example, question D: "Will the price change in the near future?" After removing the stop word and the punctuation mark, it becomes: "The price changes in the near future".
  • Step 2 Input the primary text set into the word vectorization conversion model to obtain a word vector text set, and classify the word vector text set into a training set and a test set.
  • a word vectorization conversion model is used to convert the primary text set into a word vector text set, and the word vectorization conversion model includes an input layer, a projection layer and an output layer.
  • the preferred embodiment of the present application inputs the primary text set to the input layer, and the input layer determines the appearance position of each word ⁇ in the primary text set in the primary text set Context( ⁇ ), and input the appearance position Context( ⁇ ) to the projection layer.
  • 4), Context( ⁇ 2 ) p(2
  • the projection layer performs an accumulation summation operation based on the appearance position Context( ⁇ ) to obtain an accumulation summation matrix X ⁇ , and establishes a probability model according to the X ⁇ .
  • the cumulative summation operation to obtain the cumulative summation matrix X ⁇ is:
  • V(Context( ⁇ i )) is the matrix representation form of the appearance position Context( ⁇ ), c represents the number of words in each text of the primary text set, such as the number of words in the “recent price change” Is 4.
  • the probability model is:
  • Context is the primary text set
  • is each word in the primary text set
  • the Huffman coding uses different arrangements of 0 and 1 codes to represent words according to data communication knowledge. The words are called leaf nodes, and the weight of each leaf node is expressed by Huffman coding.
  • the output layer establishes a log-likelihood function according to the probability model, and maximizes the log-likelihood function to obtain a word vector text set, and the log-likelihood function ⁇ is:
  • is the log likelihood function
  • the log likelihood function ⁇ can be further expanded based on the probability model to:
  • l ⁇ represents the number of nodes included in the path p ⁇
  • is a threshold function
  • the threshold function may be a sigmoid function
  • the method for maximizing the log likelihood function is:
  • the optimized probability model is obtained, and the optimized cumulative sum matrix X ⁇ is obtained based on the optimized probability model. Further, the word vector is obtained based on the optimized cumulative sum matrix X ⁇ , so the primary text set Can be transformed into word vector text set.
  • the word vector text set is randomly divided into training set and test set according to the number of 8:2.
  • Step 3 Input the training set and the label set into the intent recognition model for training, and exit the training until the intent recognition model meets the training requirements.
  • the intention recognition model includes a convolutional neural network
  • the convolutional neural network has sixteen convolutional layers, sixteen pooling layers, and one fully connected layer.
  • the convolutional neural network receives the training set, it inputs the training set to the first layer of convolutional layer, and the first layer of convolutional layer performs convolution operation to obtain the first convolutional data set and input to The first pooling layer;
  • the first pooling layer performs a maximization pooling operation on the first convolutional data set to obtain the first dimensionality reduction data set and input it to the second convolutional layer;
  • the two-layer convolutional layer performs the convolution operation again to obtain the second convolutional data set and input to the second-layer pooling layer to perform the maximization pooling operation to obtain the second dimensionality reduction data set, and so on, until the final Obtain the sixteenth dimensionality reduction data set, and input the sixteenth dimensionality reduction data set to the fully connected layer.
  • the fully connected layer receives the sixteenth dimensionality reduction data set, calculates the training value set in combination with an activation function, and inputs the training value set and the label set to the intention recognition
  • the loss function calculates a loss value, and judges the magnitude relationship between the loss value and a preset training threshold, until the loss value is less than the preset training threshold, the intention recognition model exits training
  • the preset training threshold is generally set to 0.1.
  • ⁇ ' is output data
  • is input data
  • k is the size of the convolution kernel of the convolution layer
  • s is the stride of the convolution operation
  • p is the data zero-filling matrix
  • the activation function is:
  • n is the size of the label set
  • y t is the training value set
  • ⁇ t is the label set.
  • Step 4 Input the test set into the intention recognition model for intention judgment, and judge the magnitude relationship between the accuracy rate and the preset accuracy rate.
  • the intent recognition model obtains the intent classification set of the test set after performing the convolution operation, pooling operation, and activation operation based on the test set, and compares the intent classification set with the label set in turn Whether they are the same, calculate the same number, and divide the same number by the total number of test sets to obtain the accuracy rate.
  • the intention recognition model judges "recent price changes" in the test set as "price change consultation", which is consistent with the actual classification as "price change consultation", so the intention recognition model is correct.
  • the accuracy rate is generally set to 95%, and when the accuracy rate is less than 95%, return to S3 to continue training.
  • Step 5 If the judgment accuracy rate is greater than the preset accuracy rate, the intention recognition model completes the training.
  • Step 6 Receive the user's text A, convert the text A into word vector text A, input it into the intention recognition model for intention judgment, and output the judgment result.
  • the text intent intelligent classification 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 (this embodiment It is executed by the processor 12) to complete this application.
  • the module referred to in this application refers to a series of computer program instruction segments capable of completing specific functions, used to describe the execution process of the text intent intelligent classification program in the text intent intelligent classification device .
  • FIG. 3 a schematic diagram of program modules of a text intent intelligent classification program in an embodiment of the text intent intelligent classification device of this application.
  • the text intent intelligent classification program can be divided into data receiving modules 10.
  • the data processing module 20, the model training module 30, and the text intention intelligent classification output module 40 are exemplary:
  • the data receiving module 10 is configured to receive an original text set and a tag set, and remove stop words and punctuation marks from the original text set to obtain a primary text set.
  • the data processing module 20 is configured to input the primary text set into a word vectorization conversion model to obtain a word vector text set, and classify the word vector text set into a training set and a test set.
  • the model training module 30 is configured to: input the training set and the label set into the intent recognition model for training until the intent recognition model meets the training requirements and then exit the training, and input the test set to the intent
  • the text intention judgment is performed, and the text intention judgment is calculated whether the content in the label set is the same and the judgment accuracy rate is obtained. If the judgment accuracy rate is less than the preset accuracy rate, the training is continued, and if the judgment accuracy rate is greater than the preset accuracy rate Accuracy, the intention recognition model is trained.
  • the text intention intelligent classification output module 40 is configured to: receive user text A, convert the text A into word vector text A, input it into the intention recognition model for text intention judgment, and output the judgment result.
  • the embodiment of the present application also proposes a computer-readable storage medium.
  • the computer-readable storage medium may be a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable only Any one or any combination of EPROM, CD-ROM, USB memory, etc.
  • the computer-readable storage medium includes a text intent intelligent classification program 10, which implements the following operations when executed by a processor:
  • the original text set and the tag set are received, and stop words and punctuation marks are removed from the original text set to obtain a primary text set.
  • the primary text set is input into the word vectorization conversion model to obtain a word vector text set, and the word vector text set is classified into a training set and a test set.
  • Receive the user's text A convert the text A into word vector text A, input it into the intent recognition model for text intent judgment, and output the judgment result.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种文本意图智能分类方法,文本意图智能分类装置,以及一种计算机可读存储介质,其中方法包括:接收原始文本集及标签集,并对原始文本集去除停用词及标点符号得到初级文本集(S1),将初级文本集输入至词向量化转换模型中得到词向量文本集,并将词向量文本集分类成训练集和测试集(S2),将训练集及标签集输入至意图识别模型中训练,直到意图识别模型满足训练要求后退出训练(S3),接收用户的文本A,并将文本A转变为词向量文本A输入至意图识别模型进行文本意图判断并输出判断结果(S6)。可以实现精准的文本意图智能分类功能。

Description

文本意图智能分类方法、装置及计算机可读存储介质
本申请基于巴黎公约申明享有2019年6月14日递交的申请号为CN201910525743.3、名称为“文本意图智能分类方法、装置及计算机可读存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本申请涉及人工智能技术领域,尤其涉及一种可用于智能化的文本意图分类方法、装置及计算机可读存储介质。
背景技术
目前,各个行业,特别是电商行业,智能回答***都有了一定程度的普及。但目前的智能回答***一般使用关键字规则或简单的检索来匹配答案后回答客户的问题,这样的回答方式往往答非所问,智能程度不够高,因此不能很好的解决客户所提出的问题,既浪费客户的时间,也浪费服务器的计算资源,并没有达到减轻人工客服压力的初衷。
发明内容
鉴于以上内容,本申请提供一种文本意图智能分类方法、装置及计算机可读存储介质。其目的在于当用户输入文本数据时,对所述用户输入的文本进行意图判断并输出判断结果。
为实现上述目的,本申请提供一种文本意图智能分类方法,该方法包括:
步骤A:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集;
步骤B:将所述初级文本集转换为词向量文本集,并将所述词向量文本集分类成训练集和测试集;
步骤C:将所述训练集及所述标签集输入至预先构建的意图识别模型中训练,直到所述意图识别模型满足预设训练要求后退出训练;
步骤D:将所述测试集输入至所述意图识别模型中进行文本意图判断, 计算对所述文本意图的判断结果与所述标签集中内容的匹配准确率,若所述匹配准确率小于预设准确率,返回步骤C,若所述匹配准确率大于所述预设准确率,所述意图识别模型完成训练;
步骤E:接收用户的文本,并将所述文本转变为词向量文本输入至所述意图识别模型进行文本意图判断,并输出判断结果。
此外,为实现上述目的,本申请还提供一种文本意图智能分类装置,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的文本意图智能分类程序,所述文本意图智能分类程序被所述处理器执行,可实现如下步骤:
步骤A:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集;
步骤B:将所述初级文本集输入至词向量化转换模型中得到词向量文本集,并将所述词向量文本集分类成训练集和测试集;
步骤C:将所述训练集及所述标签集输入至意图识别模型中训练,直到所述意图识别模型满足训练要求后退出训练;
步骤D:将所述测试集输入至所述意图识别模型中进行文本意图判断,计算所述文本意图判断与所述标签集中内容是否相同并得到判断准确率,若所述判断准确率小于预设准确率,返回步骤C,若判断准确率大于预设准确率,所述意图识别模型完成训练;
步骤E:接收用户的文本A,并将所述文本A转变为词向量文本A输入至所述意图识别模型进行文本意图判断,并输出判断结果。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中包括文本意图智能分类程序,所述文本意图智能分类程序被处理器执行时,可实现如上所述文本意图智能分类方法中的任意步骤。
本申请通过将所述初级文本集转换为词向量文本集可以有效的提高对文本特征的采集,增加文本分类的准确率,同时意图识别模型是基于深度学习,可有效的根据所述文本特征识别出文本关键字,并基于关键字进行意图分类,因此本申请提出的文本意图智能分类方法、装置及计算机可读存储介质可以实现精准的文本意图智能分类功能。
附图说明
图1为本申请一实施例提供的文本意图智能分类方法的流程示意图;
图2为本申请一实施例提供的文本意图智能分类装置的内部结构示意图;
图3为本申请一实施例提供的文本意图智能分类装置中文本意图智能分类程序的模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请提供一种文本意图智能分类方法。参照图1所示,为本申请一实施例提供的文本意图智能分类方法的流程示意图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。
在本实施例中,文本意图智能分类方法包括:
S1、接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集。
较佳地,所述原始文本集包括各种通过文字记录下的问题,如问题A:“什么时候发货”、问题B:“为什么还没有物流信息”、问题C:“双十一是否会降价”、问题D:“近期价格是否会发生变化?”等之类的问题。
进一步地,所述标签集记录所述原始文本集内各种问题的分类结果,如问题A:“什么时候发货”和问题B:“为什么还没有物流信息”在所述标签集中被记录为“发货咨询”;问题C:“双十一是否会降价”和问题D:“近期价格是否会发生变化?”在所述标签集中被记录为“价格变动咨询”。
本申请较佳实施例,所述停用词包括那个、这个、哎呀、比如、吧、但是等,所述标点符号包括句号、逗号、问好等。进一步地,本申请通过制作中文停用词表和中文标点符号表,通过比对所述原始文本集与所述中文停用 词表和中文标点符号表是否有相同部分,达到去除所述停用词及所述标点符号的目的。如问题D:“近期价格是否会发生变化?”经过去除所述停用词及所述标点符号的操作变为:“近期价格发生变化”。
S2、将所述初级文本集输入至词向量化转换模型中得到词向量文本集,并将所述词向量文本集分类成训练集和测试集。
进一步地,利用词向量化转换模型将所述初级文本集转换为词向量文本集,所述词向量化转换模型包括输入层、投影层和输出层。
较佳地,本申请较佳实施例将所述初级文本集输入至所述输入层,所述输入层确定所述初级文本集内每个词语ω在所述初级文本集的出现位置Context(ω),并将所述出现位置Context(ω)输入至所述投射层。如上述“近期价格发生变化”经过所述输入层处理后得到Context(ω 1)、Context(ω 2)、Context(ω 3)、Context(ω 4),其中ω 1为近期,ω 2为价格,ω 3为发生,ω 4为变化,Context为所述“近期价格发生变化”,则Context(ω 1)=p(1|4)、Context(ω 2)=p(2|4),依次类推。
进一步地,所述投射层基于所述出现位置Context(ω)做累加求和操作得到累加求和矩阵X ω,并根据所述X ω建立概率模型。所述累加求和操作得到累加求和矩阵X ω为:
Figure PCTCN2019102207-appb-000001
其中,V(Context(ω i))是所述出现位置Context(ω)的矩阵表示形式,c表示所述初级文本集每个文本的词语数量,如所述“近期价格发生变化”的词语数量为4。所述概率模型为:
Figure PCTCN2019102207-appb-000002
其中,p(ω|Context(ω))为所述概率模型,Context为所述初级文本集,ω为所述初级文本集内每个词语,
Figure PCTCN2019102207-appb-000003
表示在路径p ω内,第j个结点对应的Huffman编码,
Figure PCTCN2019102207-appb-000004
表示路径p ω内,第j个非叶子结点对应的向量。所述Huffman编码是根据数据通信知识用0、1码的不同排列来表示词语,词语称为叶子结点,各叶子结点的权值通过Huffman编码表现。如所述问题“近期价格发生变化”经过所述输入层处理后得到Context(ω 1),其中ω 1为“近期”,则所述“近期”为所述叶子结点,通过所述Huffman编码操作后得到编码形式,所述编码形式可用00010表示,当所述“近期”为所述叶子结点时,所述“价 格”、“发生”、“变化”为非叶子结点,所述叶子结点与所述非叶子结点统称为结点。
进一步地,所述输出层根据所述概率模型建立对数似然函数,并最大化所述对数似然函数得到词向量文本集,所述对数似然函数ζ为:
Figure PCTCN2019102207-appb-000005
其中,ζ为所述对数似然函数,
Figure PCTCN2019102207-appb-000006
是包含了所述初级文本集所有内容的集合,称为语料,进一步地,所述对数似然函数ζ基于所述概率模型可进一步扩展为:
Figure PCTCN2019102207-appb-000007
其中,l ω表示所述路径p ω中包括结点的数量,σ为阈值函数,所述阈值函数可用sigmoid函数。
较佳地,所述最大化所述对数似然函数的方法为:
Figure PCTCN2019102207-appb-000008
基于所述方法最大化
Figure PCTCN2019102207-appb-000009
后得到最优化所述概率模型,基于所述最优化概率模型得到最优化累加求和矩阵X ω,进一步地,基于所述最优化累加求和矩阵X ω得到词向量,因此所述初级文本集可转变为词向量文本集。
较佳地,将所述词向量文本集按照8:2的数量随机划分为训练集和测试集。
S3、将所述训练集及所述标签集输入至意图识别模型中训练,直到所述意图识别模型满足训练要求后退出训练。
本申请较佳实施所述意图识别模型包括卷积神经网络,所述卷积神经网络共有十六层卷积层和十六池化层、一层全连接层。当所述卷积神经网络接收所述训练集后,将所述训练集输入至第一层卷积层,所述第一层卷积层进行卷积操作后得到第一卷积数据集输入至第一层池化层;所述第一层池化层对所述第一卷积数据集进行最大化池化操作后得到第一降维数据集输入至第 二层卷积层;所述第二层卷积层再次进行所述卷积操作后得到第二卷积数据集输入至第二层池化层进行所述最大化池化操作得到第二降维数据集,以此类推,直至最终得到第十六降维数据集,将所述第十六降维数据集输入至全连接层。
较佳地,所述全连接层接收所述第十六降维数据集,并结合激活函数计算得到所述训练值集合,并将所述训练值集合和所述标签集输入至所述意图识别模型的损失函数中,所述损失函数计算出损失值,判断所述损失值与预设训练阈值的大小关系,直至所述损失值小于所述预设训练阈值时,所述意图识别模型退出训练,所述预设训练阈值一般设置为0.1。
本申请较佳实施例所述卷积层的卷积操作为:
Figure PCTCN2019102207-appb-000010
其中ω’为输出数据,ω为输入数据,k为所述卷积层的卷积核大小,s为所述卷积操作的步幅,p为数据补零矩阵;
所述激活函数为:
Figure PCTCN2019102207-appb-000011
其中y为所述训练值集合,e为无限不循环小数。
本申请较佳实施例所述损失值T为:
Figure PCTCN2019102207-appb-000012
其中,n为所述标签集的大小,y t为所述训练值集合,μ t为所述标签集。
S4、将所述测试集输入至所述意图识别模型中进行意图判断,判断准确率和预设准确率的大小关系。
若判断准确率小于预设准确率,返回S3。
进一步地,所述步骤S4包括:
所述意图识别模型基于所述测试集进行上述卷积操作、池化操作、激活操作后得到所述测试集的意图分类集合,依次比对所述意图分类集合与所述标签集是否相同,并计算相同的数量,将所述相同的数量除以所述测试集总数得到准确率。
例如,所述意图识别模型将测试集中“近期价格发生变化”判断为“价格变动咨询”,与实际被分类为“价格变动咨询”一致,因此所述意图识别模 型判断正确。进一步地,所述准确率一般设置为95%,当所述准确率小于95%时,重新返回S3继续训练。
若判断准确率大于预设准确率,则S5、所述意图识别模型完成训练。
S6、接收用户的文本A,并将所述文本A转变为词向量文本A输入至所述意图识别模型进行意图判断,并输出判断结果。
本申请提供一种文本意图智能分类装置。参照图2所示,为本申请一实施例提供的文本意图智能分类装置的内部结构示意图。
在本实施例中,所述文本意图智能分类装置1可以是PC(Personal Computer,个人电脑),或者是智能手机、平板电脑、便携计算机等终端设备,也可以是一种服务器等。该文本意图智能分类装置1至少包括存储器11、处理器12,通信总线13,以及网络接口14。
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是文本意图智能分类装置1的内部存储单元,例如该文本意图智能分类装置1的硬盘。存储器11在另一些实施例中也可以是文本意图智能分类装置1的外部存储设备,例如文本意图智能分类装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括文本意图智能分类装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于文本意图智能分类装置1的应用软件及各类数据,例如文本意图智能分类程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行文本意图智能分类程序01等。
通信总线13用于实现这些组件之间的连接通信。
网络接口14可选的可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该装置1与其他电子设备之间建立通信连接。
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标 准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在文本意图智能分类装置1中处理的信息以及用于显示可视化的用户界面。
图2仅示出了具有组件11-14以及文本意图智能分类程序01的文本意图智能分类装置1,本领域技术人员可以理解的是,图1示出的结构并不构成对文本意图智能分类装置1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
在图2所示的装置1实施例中,存储器11中存储有文本意图智能分类程序01;处理器12执行存储器11中存储的文本意图智能分类程序01时实现如下步骤:
步骤一、接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集。
较佳地,所述原始文本集包括各种通过文字记录下的问题,如问题A:“什么时候发货”、问题B:“为什么还没有物流信息”、问题C:“双十一是否会降价”、问题D:“近期价格是否会发生变化?”等之类的问题。
进一步地,所述标签集记录所述原始文本集内各种问题的分类结果,如问题A:“什么时候发货”和问题B:“为什么还没有物流信息”在所述标签集中被记录为“发货咨询”;问题C:“双十一是否会降价”和问题D:“近期价格是否会发生变化?”在所述标签集中被记录为“价格变动咨询”。
本申请较佳实施例,所述停用词包括那个、这个、哎呀、比如、吧、但是等,所述标点符号包括句号、逗号、问好等。进一步地,本申请通过制作中文停用词表和中文标点符号表,通过比对所述原始文本集与所述中文停用词表和中文标点符号表是否有相同部分,达到去除所述停用词及所述标点符号的目的。如问题D:“近期价格是否会发生变化?”经过去除所述停用词及所述标点符号的操作变为:“近期价格发生变化”。
步骤二、将所述初级文本集输入至词向量化转换模型中得到词向量文本集,并将所述词向量文本集分类成训练集和测试集。
进一步地,利用词向量化转换模型将所述初级文本集转换为词向量文本 集,所述词向量化转换模型包括输入层、投影层和输出层。
较佳地,本申请较佳实施例将所述初级文本集输入至所述输入层,所述输入层确定所述初级文本集内每个词语ω在所述初级文本集的出现位置Context(ω),并将所述出现位置Context(ω)输入至所述投射层。如上述“近期价格发生变化”经过所述输入层处理后得到Context(ω 1)、Context(ω 2)、Context(ω 3)、Context(ω 4),其中ω 1为近期,ω 2为价格,ω 3为发生,ω 4为变化,Context为所述“近期价格发生变化”,则Context(ω 1)=p(1|4)、Context(ω 2)=p(2|4),依次类推。
进一步地,所述投射层基于所述出现位置Context(ω)做累加求和操作得到累加求和矩阵X ω,并根据所述X ω建立概率模型。所述累加求和操作得到累加求和矩阵X ω为:
Figure PCTCN2019102207-appb-000013
其中,V(Context(ω i))是所述出现位置Context(ω)的矩阵表示形式,c表示所述初级文本集每个文本的词语数量,如所述“近期价格发生变化”的词语数量为4。所述概率模型为:
Figure PCTCN2019102207-appb-000014
其中,p(ω|Context(ω))为所述概率模型,Context为所述初级文本集,ω为所述初级文本集内每个词语,
Figure PCTCN2019102207-appb-000015
表示在路径p ω内,第j个结点对应的Huffman编码,
Figure PCTCN2019102207-appb-000016
表示路径p ω内,第j个非叶子结点对应的向量。所述Huffman编码是根据数据通信知识用0、1码的不同排列来表示词语,词语称为叶子结点,各叶子结点的权值通过Huffman编码表现。如所述问题“近期价格发生变化”经过所述输入层处理后得到Context(ω 1),其中ω 1为“近期”,则所述“近期”为所述叶子结点,通过所述Huffman编码操作后得到编码形式,所述编码形式可用00010表示,当所述“近期”为所述叶子结点时,所述“价格”、“发生”、“变化”为非叶子结点,所述叶子结点与所述非叶子结点统称为结点。
进一步地,所述输出层根据所述概率模型建立对数似然函数,并最大化所述对数似然函数得到词向量文本集,所述对数似然函数ζ为:
Figure PCTCN2019102207-appb-000017
其中,ζ为所述对数似然函数,
Figure PCTCN2019102207-appb-000018
是包含了所述初级文本集所有内容的集合,称为语料,进一步地,所述对数似然函数ζ基于所述概率模型可进一步扩展为:
Figure PCTCN2019102207-appb-000019
其中,l ω表示所述路径p ω中包括结点的数量,σ为阈值函数,所述阈值函数可用sigmoid函数。
较佳地,所述最大化所述对数似然函数的方法为:
Figure PCTCN2019102207-appb-000020
基于所述方法最大化
Figure PCTCN2019102207-appb-000021
后得到最优化所述概率模型,基于所述最优化概率模型得到最优化累加求和矩阵X ω,进一步地,基于所述最优化累加求和矩阵X ω得到词向量,因此所述初级文本集可转变为词向量文本集。
较佳地,将所述词向量文本集按照8:2的数量随机划分为训练集和测试集。
步骤三、将所述训练集及所述标签集输入至意图识别模型中训练,直到所述意图识别模型满足训练要求后退出训练。
本申请较佳实施所述意图识别模型包括卷积神经网络,所述卷积神经网络共有十六层卷积层和十六池化层、一层全连接层。当所述卷积神经网络接收所述训练集后,将所述训练集输入至第一层卷积层,所述第一层卷积层进行卷积操作后得到第一卷积数据集输入至第一层池化层;所述第一层池化层对所述第一卷积数据集进行最大化池化操作后得到第一降维数据集输入至第二层卷积层;所述第二层卷积层再次进行所述卷积操作后得到第二卷积数据集输入至第二层池化层进行所述最大化池化操作得到第二降维数据集,以此类推,直至最终得到第十六降维数据集,将所述第十六降维数据集输入至全连接层。
较佳地,所述全连接层接收所述第十六降维数据集,并结合激活函数计算得到所述训练值集合,并将所述训练值集合和所述标签集输入至所述意图识别模型的损失函数中,所述损失函数计算出损失值,判断所述损失值与预设训练阈值的大小关系,直至所述损失值小于所述预设训练阈值时,所述意图识别模型退出训练,所述预设训练阈值一般设置为0.1。
本申请较佳实施例所述卷积层的卷积操作为:
Figure PCTCN2019102207-appb-000022
其中ω’为输出数据,ω为输入数据,k为所述卷积层的卷积核大小,s为所述卷积操作的步幅,p为数据补零矩阵;
所述激活函数为:
Figure PCTCN2019102207-appb-000023
其中y为所述训练值集合,e为无限不循环小数。
本申请较佳实施例所述损失值T为:
Figure PCTCN2019102207-appb-000024
其中,n为所述标签集的大小,y t为所述训练值集合,μ t为所述标签集。
步骤四、将所述测试集输入至所述意图识别模型中进行意图判断,判断准确率和预设准确率的大小关系。
若判断准确率小于预设准确率,返回步骤三。
较佳地,所述意图识别模型基于所述测试集进行上述卷积操作、池化操作、激活操作后得到所述测试集的意图分类集合,依次比对所述意图分类集合与所述标签集是否相同,并计算相同的数量,将所述相同的数量除以所述测试集总数得到准确率。如所述意图识别模型将测试集中“近期价格发生变化”判断为“价格变动咨询”,与实际被分类为“价格变动咨询”一致,因此所述意图识别模型判断正确。进一步地,所述准确率一般设置为95%,当所述准确率小于95%时,重新返回S3继续训练。
步骤五、若判断准确率大于预设准确率,则所述意图识别模型完成训练。
步骤六、接收用户的文本A,并将所述文本A转变为词向量文本A输入至所述意图识别模型进行意图判断,并输出判断结果。
可选地,在其他实施例中,文本意图智能分类程序还可以被分割为一个 或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行以完成本申请,本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述文本意图智能分类程序在文本意图智能分类装置中的执行过程。
例如,参照图3所示,为本申请文本意图智能分类装置一实施例中的文本意图智能分类程序的程序模块示意图,该实施例中,所述文本意图智能分类程序可以被分割为数据接收模块10、数据处理模块20、模型训练模块30、文本意图智能分类输出模块40示例性地:
所述数据接收模块10用于:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集。
所述数据处理模块20用于:将所述初级文本集输入至词向量化转换模型中得到词向量文本集,并将所述词向量文本集分类成训练集和测试集。
所述模型训练模块30用于:将所述训练集及所述标签集输入至意图识别模型中训练,直到所述意图识别模型满足训练要求后退出训练,将所述测试集输入至所述意图识别模型中进行文本意图判断,计算所述文本意图判断与所述标签集中内容是否相同并得到判断准确率,若所述判断准确率小于预设准确率则继续训练,若判断准确率大于预设准确率,所述意图识别模型完成训练。
所述文本意图智能分类输出模块40用于:接收用户的文本A,并将所述文本A转变为词向量文本A输入至所述意图识别模型进行文本意图判断,并输出判断结果。
上述数据接收模块10、数据处理模块20、模型训练模块30、文本意图智能分类输出模块40等程序模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。
此外,本申请实施例还提出一种计算机可读存储介质,该计算机可读存储介质可以是硬盘、多媒体卡、SD卡、闪存卡、SMC、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器等等中的任意一种或者几种的任意组合。所述计算机可读存储介质中包括文本意图智能分类程序10,所述文本意图智能分类程序10被处理器执行时实现如下操作:
接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集。
将所述初级文本集输入至词向量化转换模型中得到词向量文本集,并将所述词向量文本集分类成训练集和测试集。
将所述训练集及所述标签集输入至意图识别模型中训练,直到所述意图识别模型满足训练要求后退出训练,将所述测试集输入至所述意图识别模型中进行文本意图判断,计算所述文本意图判断与所述标签集中内容是否相同并得到判断准确率,若所述判断准确率小于预设准确率则继续训练,若判断准确率大于预设准确率,所述意图识别模型完成训练。
接收用户的文本A,并将所述文本A转变为词向量文本A输入至所述意图识别模型进行文本意图判断,并输出判断结果。
本申请之计算机可读存储介质的具体实施方式与上述文本意图智能分类方法的具体实施方式大致相同,在此不再赘述。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
需要说明的是,上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间 接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种文本意图智能分类方法,其特征在于,所述方法包括:
    步骤A:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集;
    步骤B:将所述初级文本集转换为词向量文本集,并将所述词向量文本集分类成训练集和测试集;
    步骤C:将所述训练集及所述标签集输入至预先构建的意图识别模型中训练,直到所述意图识别模型满足预设训练要求后退出训练;
    步骤D:将所述测试集输入至所述意图识别模型中进行文本意图判断,计算对所述文本意图的判断结果与所述标签集中内容的匹配准确率,若所述匹配准确率小于预设准确率,返回步骤C,若所述匹配准确率大于所述预设准确率,所述意图识别模型完成训练;
    步骤E:接收用户的文本,并将所述文本转变为词向量文本输入至所述意图识别模型进行文本意图判断,并输出判断结果。
  2. 如权利要求1所述的文本意图智能分类方法,其特征在于,所述步骤B包括:
    利用词向量化转换模型将所述初级文本集转换为词向量文本集,所述词向量化转换模型包括输入层、投影层和输出层。
  3. 如权利要求1所述的文本意图智能分类方法,其特征在于,所述将所述初级文本集转换为词向量文本集包括:
    确定所述初级文本集内每个词语ω在所述初级文本集的出现位置Context(ω);
    基于所述出现位置Context(ω)做累加求和操作得到累加求和矩阵X ω,并根据所述X ω建立概率模型;
    根据所述概率模型建立对数似然函数,并最大化所述对数似然函数得到所述词向量文本集。
  4. 如权利要求3所述的文本意图智能分类方法,其特征在于,所述概率模型为:
    Figure PCTCN2019102207-appb-100001
    其中,p(ω|Context(ω))为所述概率模型,Context为所述初级文本集,ω为 所述初级文本集内每个词语,
    Figure PCTCN2019102207-appb-100002
    表示在路径p ω内,第j个结点对应的Huffman编码,
    Figure PCTCN2019102207-appb-100003
    表示路径p ω内,第j个非叶子结点对应的向量。
  5. 如权利要求4中的文本意图智能分类方法,其特征在于,所述对数似然函数为:
    Figure PCTCN2019102207-appb-100004
    其中,ζ为所述对数似然函数,
    Figure PCTCN2019102207-appb-100005
    是包含了所述初级文本集所有内容的集合,其中,所述对数似然函数ζ基于所述概率模型可进一步扩展为:
    Figure PCTCN2019102207-appb-100006
    其中,l ω表示所述路径p ω中包括结点的数量,σ为阈值函数。
  6. 如权利要求1至5任意一项所述的文本意图智能分类方法,其特征在于,所述意图识别模型包括卷积神经网络、激活函数、损失函数,其中,所述卷积神经网络包括十六层卷积层和十六层池化层、一层全连接层;
    所述步骤C包括:
    所述卷积神经网络接收所述训练集后,将所述训练集输入至所述十六层卷积层和十六层池化层进行卷积操作和最大池化操作得到降维数据集,并将所述降维数据集输入至全连接层;
    所述全连接层接收所述降维数据集,并结合所述激活函数计算得到训练值集合,并将所述训练值集合和所述标签集输入至所述损失函数中,所述损失函数计算出损失值,判断所述损失值与预设训练阈值的大小关系,直至所述损失值小于所述预设训练阈值时,所述意图识别模型满足所述预设训练要求并退出训练。
  7. 如权利要求6所述的文本意图智能分类方法,其特征在于,所述步骤D包括:
    所述意图识别模型基于所述测试集进行卷积操作、池化操作、激活操作,得到所述测试集的意图分类集合,依次比对所述意图分类集合与所述标签集是否相同,并计算相同的数量,将所述相同的数量除以所述测试集总数得到准确率。
  8. 一种文本意图智能分类装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的文本意图智能分类程序,所述文本意图智能分类程序被所述处理器执行时实现如下步骤:
    步骤A:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集;
    步骤B:将所述初级文本集转换为词向量文本集,并将所述词向量文本集分类成训练集和测试集;
    步骤C:将所述训练集及所述标签集输入至预先构建的意图识别模型中训练,直到所述意图识别模型满足预设训练要求后退出训练;
    步骤D:将所述测试集输入至所述意图识别模型中进行文本意图判断,计算对所述文本意图的判断结果与所述标签集中内容的匹配准确率,若所述匹配准确率小于预设准确率,返回步骤C,若所述匹配准确率大于所述预设准确率,所述意图识别模型完成训练;
    步骤E:接收用户的文本,并将所述文本转变为词向量文本输入至所述意图识别模型进行文本意图判断,并输出判断结果。
  9. 如权利要求8所述的文本意图智能分类装置,其特征在于,所述步骤B包括:
    利用词向量化转换模型将所述初级文本集转换为词向量文本集,所述词向量化转换模型包括输入层、投影层和输出层。
  10. 如权利要求8所述的文本意图智能分类装置,其特征在于,所述将所述初级文本集转换为词向量文本集包括:
    确定所述初级文本集内每个词语ω在所述初级文本集的出现位置Context(ω);
    基于所述出现位置Context(ω)做累加求和操作得到累加求和矩阵X ω,并根据所述X ω建立概率模型;
    根据所述概率模型建立对数似然函数,并最大化所述对数似然函数得到所述词向量文本集。
  11. 如权利要求10所述的文本意图智能分类装置,其特征在于,所述概率模型为:
    Figure PCTCN2019102207-appb-100007
    其中,p(ω|Context(ω))为所述概率模型,Context为所述初级文本集,ω为所述初级文本集内每个词语,
    Figure PCTCN2019102207-appb-100008
    表示在路径p ω内,第j个结点对应的Huffman编码,
    Figure PCTCN2019102207-appb-100009
    表示路径p ω内,第j个非叶子结点对应的向量。
  12. 如权利要求11中的文本意图智能分类装置,其特征在于,所述对数似然函数为:
    Figure PCTCN2019102207-appb-100010
    其中,ζ为所述对数似然函数,
    Figure PCTCN2019102207-appb-100011
    是包含了所述初级文本集所有内容的集合,其中,所述对数似然函数ζ基于所述概率模型可进一步扩展为:
    Figure PCTCN2019102207-appb-100012
    其中,l ω表示所述路径p ω中包括结点的数量,σ为阈值函数。
  13. 如权利要求8至12任意一项所述的文本意图智能分类装置,其特征在于,所述意图识别模型包括卷积神经网络、激活函数、损失函数,其中,所述卷积神经网络包括十六层卷积层和十六层池化层、一层全连接层;
    所述步骤C包括:
    所述卷积神经网络接收所述训练集后,将所述训练集输入至所述十六层卷积层和十六层池化层进行卷积操作和最大池化操作得到降维数据集,并将所述降维数据集输入至全连接层;
    所述全连接层接收所述降维数据集,并结合所述激活函数计算得到训练值集合,并将所述训练值集合和所述标签集输入至所述损失函数中,所述损失函数计算出损失值,判断所述损失值与预设训练阈值的大小关系,直至所述损失值小于所述预设训练阈值时,所述意图识别模型满足所述预设训练要求并退出训练。
  14. 如权利要求13所述的文本意图智能分类装置,其特征在于,所述步骤D包括:
    所述意图识别模型基于所述测试集进行卷积操作、池化操作、激活操作,得到所述测试集的意图分类集合,依次比对所述意图分类集合与所述标签集是否相同,并计算相同的数量,将所述相同的数量除以所述测试集总数得到准确率。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有文本意图智能分类程序,所述文本意图智能分类程序可被一个或者多个处理器执行,可实现如下步骤:
    步骤A:接收原始文本集及标签集,并对所述原始文本集去除停用词及标点符号得到初级文本集;
    步骤B:将所述初级文本集转换为词向量文本集,并将所述词向量文本集分类成训练集和测试集;
    步骤C:将所述训练集及所述标签集输入至预先构建的意图识别模型中训练,直到所述意图识别模型满足预设训练要求后退出训练;
    步骤D:将所述测试集输入至所述意图识别模型中进行文本意图判断,计算对所述文本意图的判断结果与所述标签集中内容的匹配准确率,若所述匹配准确率小于预设准确率,返回步骤C,若所述匹配准确率大于所述预设准确率,所述意图识别模型完成训练;
    步骤E:接收用户的文本,并将所述文本转变为词向量文本输入至所述意图识别模型进行文本意图判断,并输出判断结果。
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述步骤B包括:
    利用词向量化转换模型将所述初级文本集转换为词向量文本集,所述词向量化转换模型包括输入层、投影层和输出层。
  17. 如权利要求15所述的计算机可读存储介质,其特征在于,所述将所述初级文本集转换为词向量文本集包括:
    确定所述初级文本集内每个词语ω在所述初级文本集的出现位置Context(ω);
    基于所述出现位置Context(ω)做累加求和操作得到累加求和矩阵X ω,并根据所述X ω建立概率模型;
    根据所述概率模型建立对数似然函数,并最大化所述对数似然函数得到所述词向量文本集。
  18. 如权利要求17所述的计算机可读存储介质,其特征在于,所述概率模型为:
    Figure PCTCN2019102207-appb-100013
    其中,p(ω|Context(ω))为所述概率模型,Context为所述初级文本集,ω为所述初级文本集内每个词语,
    Figure PCTCN2019102207-appb-100014
    表示在路径p ω内,第j个结点对应的Huffman编码,
    Figure PCTCN2019102207-appb-100015
    表示路径p ω内,第j个非叶子结点对应的向量。
  19. 如权利要求18中的计算机可读存储介质,其特征在于,所述对数似然函数为:
    Figure PCTCN2019102207-appb-100016
    其中,ζ为所述对数似然函数,
    Figure PCTCN2019102207-appb-100017
    是包含了所述初级文本集所有内容的集合,其中,所述对数似然函数ζ基于所述概率模型可进一步扩展为:
    Figure PCTCN2019102207-appb-100018
    其中,l ω表示所述路径p ω中包括结点的数量,σ为阈值函数。
  20. 如权利要求15至19任意一项所述的计算机可读存储介质,其特征在于,所述意图识别模型包括卷积神经网络、激活函数、损失函数,其中,所述卷积神经网络包括十六层卷积层和十六层池化层、一层全连接层;
    所述步骤C包括:
    所述卷积神经网络接收所述训练集后,将所述训练集输入至所述十六层卷积层和十六层池化层进行卷积操作和最大池化操作得到降维数据集,并将所述降维数据集输入至全连接层;
    所述全连接层接收所述降维数据集,并结合所述激活函数计算得到训练值集合,并将所述训练值集合和所述标签集输入至所述损失函数中,所述损失函数计算出损失值,判断所述损失值与预设训练阈值的大小关系,直至所述损失值小于所述预设训练阈值时,所述意图识别模型满足所述预设训练要求并退出训练。
PCT/CN2019/102207 2019-06-14 2019-08-23 文本意图智能分类方法、装置及计算机可读存储介质 WO2020248366A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910525743.3 2019-06-14
CN201910525743.3A CN110347789A (zh) 2019-06-14 2019-06-14 文本意图智能分类方法、装置及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2020248366A1 true WO2020248366A1 (zh) 2020-12-17

Family

ID=68182177

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102207 WO2020248366A1 (zh) 2019-06-14 2019-08-23 文本意图智能分类方法、装置及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110347789A (zh)
WO (1) WO2020248366A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111161740A (zh) * 2019-12-31 2020-05-15 中国建设银行股份有限公司 意图识别模型训练方法、意图识别方法以及相关装置
CN112231474A (zh) * 2020-10-13 2021-01-15 中移(杭州)信息技术有限公司 意图识别方法、***、电子设备及存储介质
CN112269875B (zh) * 2020-10-23 2023-07-25 中国平安人寿保险股份有限公司 文本分类方法、装置、电子设备及存储介质
CN117672227B (zh) * 2024-01-25 2024-04-05 深圳市音随我动科技有限公司 基于智能音箱的问答控制方法、装置、计算机设备和介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104037A1 (en) * 2004-04-07 2008-05-01 Inquira, Inc. Automated scheme for identifying user intent in real-time
CN109284406A (zh) * 2018-09-03 2019-01-29 四川长虹电器股份有限公司 基于差异循环神经网络的意图识别方法
CN109325106A (zh) * 2018-07-31 2019-02-12 厦门快商通信息技术有限公司 一种医美聊天机器人意图识别方法及装置
CN109635117A (zh) * 2018-12-26 2019-04-16 零犀(北京)科技有限公司 一种基于知识图谱识别用户意图方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107622272A (zh) * 2016-07-13 2018-01-23 华为技术有限公司 一种图像分类方法及装置
KR102288249B1 (ko) * 2017-10-31 2021-08-09 텐센트 테크놀로지(센젠) 컴퍼니 리미티드 정보 처리 방법, 단말기, 및 컴퓨터 저장 매체
CN107943860B (zh) * 2017-11-08 2020-10-27 北京奇艺世纪科技有限公司 模型的训练方法、文本意图的识别方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104037A1 (en) * 2004-04-07 2008-05-01 Inquira, Inc. Automated scheme for identifying user intent in real-time
CN109325106A (zh) * 2018-07-31 2019-02-12 厦门快商通信息技术有限公司 一种医美聊天机器人意图识别方法及装置
CN109284406A (zh) * 2018-09-03 2019-01-29 四川长虹电器股份有限公司 基于差异循环神经网络的意图识别方法
CN109635117A (zh) * 2018-12-26 2019-04-16 零犀(北京)科技有限公司 一种基于知识图谱识别用户意图方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
WANG, MINGYA: "Research and Improvement on Text Classification Based on Word Embedding", CHINA MASTER'S THESES FULL-TEXT DATABASE, INFORMATION SCIENCE AND TECHNOLOGY, no. 10, 15 October 2016 (2016-10-15), ISSN: 1674-0246, DOI: 20200307181335Y *

Also Published As

Publication number Publication date
CN110347789A (zh) 2019-10-18

Similar Documents

Publication Publication Date Title
WO2020224213A1 (zh) 语句意图识别方法、装置及计算机可读存储介质
WO2020248366A1 (zh) 文本意图智能分类方法、装置及计算机可读存储介质
CN108959482B (zh) 基于深度学习的单轮对话数据分类方法、装置和电子设备
CN110442857B (zh) 情感智能判断方法、装置及计算机可读存储介质
CN110413773B (zh) 智能文本分类方法、装置及计算机可读存储介质
CN110427480B (zh) 个性化文本智能推荐方法、装置及计算机可读存储介质
CN113407660B (zh) 非结构化文本事件抽取方法
CN108038208B (zh) 上下文信息识别模型的训练方法、装置和存储介质
CN110866042B (zh) 表格智能查询方法、装置及计算机可读存储介质
WO2021204017A1 (zh) 文本意图识别方法、装置以及相关设备
US20220406034A1 (en) Method for extracting information, electronic device and storage medium
CN110377733B (zh) 一种基于文本的情绪识别方法、终端设备及介质
CN110795548A (zh) 智能问答方法、装置及计算机可读存储介质
CN113360654B (zh) 文本分类方法、装置、电子设备及可读存储介质
WO2023040742A1 (zh) 文本数据的处理方法、神经网络的训练方法以及相关设备
CN114880449B (zh) 智能问答的答复生成方法、装置、电子设备及存储介质
WO2021223882A1 (en) Prediction explanation in machine learning classifiers
WO2021139076A1 (zh) 智能化文本对话生成方法、装置及计算机可读存储介质
CN110717333B (zh) 文章摘要自动生成方法、装置及计算机可读存储介质
CN115730597A (zh) 多级语义意图识别方法及其相关设备
CN110570844B (zh) 语音情绪识别方法、装置及计算机可读存储介质
CN112906368B (zh) 行业文本增量方法、相关装置及计算机程序产品
CN110765765A (zh) 基于人工智能的合同关键条款提取方法、装置及存储介质
CN114238602A (zh) 基于语料匹配的对话分析方法、装置、设备及存储介质
CN116775875A (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: 19932326

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

Country of ref document: EP

Kind code of ref document: A1