WO2017071474A1 - 一种语料处理方法和装置及语料分析方法和装置 - Google Patents

一种语料处理方法和装置及语料分析方法和装置 Download PDF

Info

Publication number
WO2017071474A1
WO2017071474A1 PCT/CN2016/101921 CN2016101921W WO2017071474A1 WO 2017071474 A1 WO2017071474 A1 WO 2017071474A1 CN 2016101921 W CN2016101921 W CN 2016101921W WO 2017071474 A1 WO2017071474 A1 WO 2017071474A1
Authority
WO
WIPO (PCT)
Prior art keywords
corpus
intent
word
weight
words
Prior art date
Application number
PCT/CN2016/101921
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 WO2017071474A1 publication Critical patent/WO2017071474A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of mobile communications, and in particular, to a corpus processing method and apparatus, and a corpus analysis method and apparatus.
  • the automatic question answering system improves the efficiency and accuracy of user retrieval by understanding the questions of people's natural language forms, returning answers or text fragments containing answers.
  • the present invention has been proposed to provide a corpus that overcomes the above problems or at least partially solves the above problems. Processing method and device and corpus analysis method and device.
  • the invention provides a corpus processing method, comprising:
  • the weight of each word on each intent is determined based on the number of occurrences of each word in the corpus and the number of times each word appears on each intent.
  • the word segmentation is performed on each corpus in the corpus, and the process of determining the words in each corpus includes one of the following: ansj participle, stanford participle, and Kenting.
  • the invention also provides a corpus processing device, comprising:
  • An intent determination module configured to determine an intent of each corpus in the corpus
  • a word segmentation module configured to segment each corpus in the corpus to determine words in each corpus
  • a number determination module configured to determine the number of occurrences of each word in the corpus collection, and to determine the number of times each word appears on each intent
  • the weight determination module is configured to determine the weight of each word on each intent based on the number of occurrences of each word in the corpus and the number of times each word appears on each intent.
  • the word segmentation is performed on each corpus in the corpus, and the process of determining the words in each corpus includes one of the following: ansj participle, stanford participle, and Kenting.
  • the invention also provides a corpus analysis method, comprising:
  • the intention corresponding to the weight value greater than or equal to the predetermined threshold is determined as the intent of the corpus.
  • the process of determining the weight value of each intent includes:
  • each word is weighted on the intent as the weight value for the intent.
  • the processing of determining the weight value of each intent according to the weight of each of the words on each intent comprises: adding, for each intent, weights of each word on the intent as The weight value of the intent.
  • the invention also provides a corpus analysis device, comprising:
  • a corpus acquisition module configured to obtain a corpus
  • a word segmentation module configured to perform word segmentation on the corpus to determine each word in the corpus
  • a weight acquisition module configured to obtain a weight of each word on each intent
  • a weight value determining module configured to determine a weight value of each intent according to a weight of each word on each intent
  • the intent processing module is configured to determine an intent corresponding to a weight value greater than or equal to a predetermined threshold as the intent of the corpus.
  • the weight value determination module is specifically configured to add, for each intent, each word on the intent weight as the weight value of the intent.
  • Another embodiment of the present invention provides a computer storage medium storing execution instructions for performing the method in the above embodiments.
  • a corpus processing method and apparatus and a corpus analysis method and apparatus by means of an embodiment of the present invention The automatic question answering system in the prior art is solved, which can not meet the user's needs, greatly affects the user's satisfaction, reduces the user experience, and can analyze the user's communication purpose according to the user's interaction information, that is, the user's intention Identification is carried out in order to respond to the user's questions in a targeted manner, satisfying the user's needs and improving the user experience.
  • FIG. 1 is a flow chart of a corpus processing method according to an embodiment of the present invention.
  • FIG. 2 is a flow chart of a corpus analysis method according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a corpus processing apparatus according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a corpus analysis apparatus according to an embodiment of the present invention.
  • the present invention provides a corpus processing method and device, and a corpus analysis method and device, which can be based on the user.
  • Interaction information to analyze the user's communication purpose that is, to identify the user's intention, in order to respond to the user's question in a targeted manner. Meet the needs of users and improve the user experience.
  • FIG. 1 is a flowchart of a corpus processing method according to an embodiment of the present invention.
  • a corpus processing method according to an embodiment of the present invention includes the following processing:
  • Step 101 Obtain all or part of the corpus as a corpus collection
  • Step 102 Determine an intent of each corpus in the corpus collection
  • Step 103 segmenting each corpus in the corpus, determining words in each corpus, and segmenting the corpus, one of the following methods may be used: ansj participle, stanford participle, ⁇ , where ansj participle is An open source Java Chinese word segmentation tool based on the Chinese Academy of Sciences' ictclas Chinese word segmentation algorithm.
  • the stanford participle is a Chinese word segmentation tool developed by Stanford University's Natural Language Processing Laboratory for Chinese;
  • Step 104 determining the number of occurrences of each word in the corpus collection
  • Step 105 determining the number of times each word appears on each intent
  • Step 106 determining the weight of each word on each intent according to the number of occurrences of each word in the corpus and the number of times each word appears on each intent, and determining each word in each of the following formulas Intentional weight F(X i ):
  • F(X i ) (M i /P)*(1/Ln(P)), where F(X i ) represents the weight of Xi on the intent M, where M i represents a word and i represents the number of the word in the range of i is a natural number, M is intended, M i X i represents the number appearing on the intended M, P X i represents the total number appearing in the corpus set, Ln is the natural logarithm.
  • FIG. 2 is a flowchart of a corpus analysis method according to an embodiment of the present invention.
  • a corpus analysis method according to an embodiment of the present invention includes the following processing:
  • Step 201 Obtain a corpus
  • Step 202 Perform word segmentation on the corpus to determine each word in the corpus;
  • Step 203 Obtain a weight of each word on each intent
  • Step 204 Determine a weight value of each intent according to the weight of each word on each intent. Specifically, for each intent, add each word weight on the intent as the weight value of the intent. ;
  • Step 205 Determine an intent corresponding to the weight value greater than or equal to the predetermined threshold as the intent of the corpus.
  • the question is first segmented, and after the word segmentation, the probability values of the words in each intention are calculated one by one, and then summed.
  • the intention with the largest probability value may be selected.
  • the user's communication purpose can be analyzed according to the user's interaction information, that is, the user's intention is identified, so as to respond to the user's problem in a targeted manner, satisfying the user's needs, and improving the user experience.
  • the embodiment of the present invention is divided into two parts: an offline part (ie, the method embodiment 1 described above) and an online part (ie, the method embodiment 2 described above).
  • the offline part trains the "intent model” according to the annotated corpus, and makes a data basis for the subsequent intent recognition processing; the operation is performed offline, and does not affect the performance of the running system.
  • the online part the user enters a statement, first performs preprocessing, word segmentation, etc., and then calculates the intent probability of each word according to the "intent model", then sums up the summation, and finally draws the intention of the statement.
  • the corpus annotation is the basic data basis for the intent recognition.
  • the quality of the corpus annotation directly affects the accuracy of the intent recognition.
  • the training process is the core of the present invention.
  • the probability of "chilling intention” is 10%*0.434, and the probability of "question-and-answer” of "software” is 90%*0.434, which means that when the word "software” appears in a new statement, the statement is "question-and-answer".
  • the intent model is formed, and the intent probability value of the word is calculated according to the statistics of the words and the ratio of the words in each intention, and the intent model is generated, and the data model can be stored in a txt file or an excel statement, and run. It can be stored in memory, and the final result is as shown in Table 2 below:
  • the main purpose of this process is to filter out noise parts that are not helpful for intent recognition, such as spaces at the beginning or end, ⁇ , #, &, tabs, and so on.
  • Intention calculation is the ultimate goal of the present invention.
  • data preprocessing ie, statement preprocessing
  • statement preprocessing is mainly used to filter the noise parts that are not helpful for intent recognition, such as: beginning or ending spaces, ⁇ , #, &, Tabs, etc.; then word segmentation, using the Chinese word segmentation tool to break the statement into a set of words, for example: Ningxia / Software / Upgrade / find / who /?
  • the Chinese word segmentation tool can use ansj participle, stanford participle, ⁇ , etc.; obtain the word intent probability value, and the meaning probability value of the word can be directly queried in the above “intent model” (for example, Table 2 above), which is denoted as X i .
  • the design, the intention to take the maximum probability value is the final intent of the statement.
  • the intent number is converted into the final intent. For example, 0 represents the intention of the cold and 1 represents the intent of the question and answer.
  • the system identified the intent of “Chilling, Q&A” with an accuracy rate of 99.7%.
  • the ultimate goal of the present invention is to identify the intent of the user interaction information, first collecting the corpus and labeling, segmenting the corpus, and counting the intent probability value of the word to obtain a probability model, after the user enters the interactive statement.
  • the user sentence is segmented, and the word intention probability value is weighted and summed according to the above probability model, and the intention probability value of the whole sentence is obtained, and the intention of the maximum probability value is the intention of the statement.
  • the corpus processing apparatus includes an obtaining module 30, an intent determining module 32, a word segment determining module 34, a number determining module 36, and a weight determining module 38, wherein ,
  • the obtaining module 30 is configured to obtain all or part of the corpus as a corpus collection
  • the intent determination module 32 is configured to determine an intent of each corpus in the corpus
  • the word segmentation determining module 34 is configured to perform word segmentation on each corpus in the corpus to determine words in each corpus;
  • the number determination module 36 is configured to determine the number of occurrences of each word in the corpus, and to determine the number of times each word appears on each intent;
  • the weight determination module 38 is configured to determine the weight of each word on each intent according to the number of occurrences of each word in the corpus and the number of times each word appears on each intent weight.
  • the corpus analysis apparatus includes a corpus acquisition module 40, a word segmentation processing module 42, a weight acquisition module 44, a weight value determination module 46, and an intention processing module 48. ,among them:
  • the corpus acquisition module 40 is configured to acquire a corpus
  • the word segmentation processing module 42 is configured to perform word segmentation processing on the corpus to determine each word in the corpus;
  • the weight obtaining module 44 is configured to obtain a weight of each word on each intent
  • the weight value determining module 46 is configured to determine a weight value of each intent according to the weight of each of the words on each intent;
  • the intent processing module 48 is arranged to determine an intent corresponding to a weight value greater than or equal to a predetermined threshold as the intent of the corpus.
  • the weight value determining module is specifically configured to add, for each intent, weights of each word on the intent as the weight value of the intent.
  • the present invention uses a probabilistic model, does not need to collect user click behavior data and session data, is simple and fast, and has high efficiency, and the present invention mainly aims at the intent of the sentence in the question and answer system, and more accurately answers the user according to the sentence intention. Problems, improve user satisfaction.
  • the invention can achieve a good recognition effect through simple data set training, and does not require the user to click on records, user operation records, session logs and the like, and does not need to summarize entities, feature words, and syntax formats. Therefore, the present invention is an intent recognition method which is simple and practical, has high efficiency and high recognition rate.
  • modules in the client in the embodiment can be adaptively changed and placed in one or more clients different from the embodiment.
  • the modules in the embodiments can be combined into one module, and further they can be divided into a plurality of sub-modules or sub-units or sub-components.
  • any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed, or All processes or units of the client are combined.
  • This specification including accompanying Each feature disclosed in the claims, the abstract and the drawings may be replaced by alternative features that provide the same, equivalent or similar purpose.
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components loaded with the ordered web address in accordance with an embodiment of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
  • a corpus processing method and apparatus and corpus analysis provided by embodiments of the present invention are provided.
  • the method and the device have the following beneficial effects: the corpus processing method and device and the corpus analysis method and device of the embodiments of the present invention solve the prior art automatic question answering system, which can not meet the user's demand and greatly affects the user's satisfaction.
  • the problem of user experience is reduced, and the user's communication purpose can be analyzed according to the user's interaction information, that is, the user's intention is identified, so as to respond to the user's problem in a targeted manner, satisfying the user's needs and improving the user experience. .

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)
  • Machine Translation (AREA)

Abstract

本发明公开了一种语料处理方法和装置及语料分析方法和装置。该方法包括:获取所有或部分语料,作为语料集合;确定语料集合中每一条语料对应的意图;对语料集合中的每一条语料进行分词,确定每条语料中的词语;确定语料集合中每个词语出现的次数;确定每个词语在每个意图上出现的次数;根据语料集合中每个词语出现的次数和每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重。

Description

一种语料处理方法和装置及语料分析方法和装置 技术领域
本发明涉及移动通讯领域,特别是涉及一种语料处理方法和装置及语料分析方法和装置。
背景技术
随着海量网络信息的积累和规模的高速增长,准确快捷的找到自己所需要的信息已成为人们迫切的需求。自动问答系统通过理解人们自然语言形式的问句,返回答案或者包含答案的文本片段,在一定程度上提高了用户检索的效率和准确性。
但是,在实际的应用环境中,由于自然语言自身的特性和用户对系统的不熟悉,导致用户录入的交互信息很随意;有时是寒暄信息,或业务质询,或对系统的投诉;有时是价格咨询,或业务流程咨询,或产品基本信息咨询;如果不做区别的应答,答案的准确性将会大打折扣,无法满足用户需求,极大地影响了用户的满意度,降低了用户体验。
发明内容
鉴于现有技术中自动问答系统,无法满足用户需求,及大地影响了用户的满意度,降低了用户体验的问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的语料处理方法和装置及语料分析方法和装置。
本发明提供一种语料处理方法,包括:
获取所有或部分语料,作为语料集合;
确定语料集合中每一条语料对应的意图;
对语料集合中的每一条语料进行分词,确定每条语料中的词语;
确定语料集合中每个词语出现的次数;
确定每个词语在每个意图上出现的次数;
根据语料集合中每个词语出现的次数和每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重。
可选地,利用下述公式确定每个词语在每个意图上的权重F(Xi):F(Xi)=(Mi/P)*(1/Ln(P)),其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在所述语料集合中出现的总次数,Ln是自然对数。
可选地,所述对语料集合中的每一条语料进行分词,确定每条语料中的词语的处理包括以下之一:ansj分词、stanford分词、庖丁解牛。
本发明还提供了一种语料处理装置,包括:
获取模块,设置为获取所有或部分语料,作为语料集合;
意图确定模块,设置为确定语料集合中每一条语料对应的意图;
分词确定模块,设置为对语料集合中的每一条语料进行分词,确定每条语料中的词语;
次数确定模块,设置为确定语料集合中每个词语出现的次数,以及用于确定每个词语在每个意图上出现的次数;
权重确定模块,设置为根据语料集合中每个词语出现的次数和每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重。
可选地,利用下述公式确定每个词语在每个意图上的权重F(Xi):F(Xi)=(Mi/P)*(1/Ln(P)),其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在所述语料集合中出现的总次数,Ln是自然对数。
可选地,所述对语料集合中的每一条语料进行分词,确定每条语料中的词语的处理包括以下之一:ansj分词、stanford分词、庖丁解牛。
本发明还提供了一种语料分析方法,包括:
获取一条语料;
对语料进行分词处理,确定语料中的每个词语;
获取每个词语在每个意图上的权重;
根据每个词语在每个意图上的权重,确定每个意图的权重值;
将大于或等于预定阈值的权重值对应的意图,确定为语料的意图。
其中,根据每个词语在每个意图上的权重,确定每个意图的权重值的处理包括:
对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
可选地,所述根据所述每个词语在每个意图上的权重,确定每个意图的权重值的处理包括:对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
本发明还提供了一种语料分析装置,包括:
语料获取模块,设置为获取一条语料;
分词处理模块,设置为对语料进行分词处理,确定语料中的每个词语;
权重获取模块,设置为获取每个词语在每个意图上的权重;
权重值确定模块,设置为根据每个词语在每个意图上的权重,确定每个意图的权重值;
意图处理模块,设置为将大于或等于预定阈值的权重值对应的意图,确定为语料的意图。
可选地,权重值确定模块具体设置为对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
本发明另一实施例提供了一种计算机存储介质,所述计算机存储介质存储有执行指令,所述执行指令用于执行上述实施例中的方法。
本发明有益效果如下:
借助于本发明实施例的语料处理方法和装置及语料分析方法和装置, 解决了现有技术中自动问答系统,无法满足用户需求,极大地影响了用户的满意度,降低了用户体验的问题,能够根据用户的交互信息,来分析用户的交流目的,即对用户的意图进行识别,以便对用户的问题有针对性的答复,满足了用户需求,提高了用户体验。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1是本发明实施例的语料处理方法的流程图;
图2是本发明实施例的语料分析方法的流程图;
图3是本发明实施例的语料处理装置的结构示意图;
图4是本发明实施例的语料分析装置的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。
为了解决现有技术中自动问答系统,无法满足用户需求,极大地影响了用户的满意度,降低了用户体验的问题,本发明提供了语料处理方法和装置及语料分析方法和装置,能够根据用户的交互信息,来分析用户的交流目的,即对用户的意图进行识别,以便对用户的问题有针对性的答复, 满足了用户需求,提高了用户体验。
而且,对用户的意图进行识别后,我们可以在管理后台数据时进行分类处理,把寒暄数据单独创建一个库,把业务咨询数据单独创建一个库;这样不但方便数据的管理和维护,而且还能分散数据访问压力、提高系统性能。
目前业界有关意图识别的专利和技术文档也有不少,但这些方案要么识别率低、要么架构复杂、要么应用场景不适合问答;而本发明识别率高,简单易用,能满足问答业务需求。
方法实施例一
根据本发明的实施例,提供了一种语料处理方法,图1是本发明实施例的语料处理方法的流程图,如图1所示,根据本发明实施例的语料处理方法包括如下处理:
步骤101,获取所有或部分语料,作为语料集合;
步骤102,确定语料集合中每一条语料对应的意图;
步骤103,对语料集合中的每一条语料进行分词,确定每条语料中的词语,对语料进行分词,可以采用下述方法之一:ansj分词、stanford分词、庖丁解牛,其中,ansj分词是一个开源的Java中文分词工具,基于中科院的ictclas中文分词算法,stanford分词是斯坦福大学(Stanford University)自然语言处理实验室针对中文开发的一款中文分词工具;
步骤104,确定语料集合中每个词语出现的次数;
步骤105,确定每个词语在每个意图上出现的次数;
步骤106,根据语料集合中每个词语出现的次数和每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重,可以利用下述公式确定每个词语在每个意图上的权重F(Xi):
F(Xi)=(Mi/P)*(1/Ln(P)),其中,F(Xi)表示Xi在意图M上的权重,其中,Mi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图, Mi表示Xi在意图M上出现的次数,P表示Xi在语料集合中出现的总次数,Ln是自然对数。
根据本发明实施例,首先根据应用需求,把用户的交互信息分为相应的N类,例如,N={寒暄,问答}或N={价格咨询,业务流程咨询,产品基本信息咨询};然后进行语料标注,例如收集用户交互信息的语料,比如收集1000条,并对语料进行整理(比如,删除重复语料等),然后对语料进行标注,每条语料标注一种意图;再对语料进行分词,统计每个词语出现的总次数P,并统计词语在各中意图上出现的次数Mi,计算词语Xi(Xi表示第i个词语)在意图M上的概率公式F(Xi)为:F(Xi)=(Mi/P)*(1/Ln(P)),其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在语料集合中出现的总次数,Ln是自然对数。
方法实施例二
根据本发明的实施例,提供了一种语料分析方法,图2是本发明实施例的语料分析方法的流程图,如图2所示,根据本发明实施例的语料分析方法包括如下处理:
步骤201,获取一条语料;
步骤202,对语料进行分词处理,确定所述语料中的每个词语;
步骤203,获取每个词语在每个意图上的权重;
步骤204,根据每个词语在每个意图上的权重,确定每个意图的权重值,具体地,对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值;
步骤205,将大于或等于预定阈值的权重值对应的意图,确定为所述语料的意图。
在本发明实施例中,当用户录入一个语句时,首先对问句进行分词,分词后,逐个计算词语在各个意图上的概率值,然后求和,优选地,可以选择概率值最大的意图即为语句的意图。
通过本发明实施例,能够根据用户的交互信息,来分析用户的交流目的,即对用户的意图进行识别,以便对用户的问题有针对性的答复,满足了用户需求,提高了用户体验。
下面结合具体实施例,对方法实施例一和方法实施例二进行详细说明:
从“意图识别总体架构图”可以看出,本发明实施例分为两部分:离线部分(即上文所述的方法实施例一)和在线部分(即上文所述的方法实施例二),其中,离线部分根据标注语料对“意图模型”进行训练,为后续意图识别的处理做数据基础;本操作是离线完成,不影响运行系统的性能。在线部分中,用户录入一个语句,首先做预处理、分词等,然后根据“意图模型”计算各个词语的意图概率,再汇总求和,最终得出语句的意图。
具体过程如下(在下边叙述过程中以“寒暄、问答”两个意图为例进行说明):
模型训练
1、语料标注
首先收集语料,这些语料是在问答交互系统中真实使用的语句,一般收集的语料不少于1000条,越多越好。语料标注后,形式如下表1所示:
表1
Figure PCTCN2016101921-appb-000001
语料标注是意图识别的基本数据依据,语料标注的好坏,直接影响意图识别的准确率。
2、训练模型
该训练过程是本发明的核心,首先,取一条标注语料,例如,宁夏软件升级找谁?标注为问答,该训练过程是对语料逐条进行处理,直到所有语料处理完为止;然后,进行数据预处理,该过程主要目的是过滤对意图识别无帮助的噪音部分,例如:开头或结尾的空格、~、#、&、制表符等;再进行分词处理,利用中文分词工具把语句分解成一组词语,例如:宁夏/软件/升级/找/谁/?中文分词工具可以使用ansj分词、stanford分词、庖丁解牛等;接着进行词语统计,一是统计词语出现的次数,记作P,二是统计词语在各个意图上出现的次数,意图按顺序标记为i=0、1、2、…、n,词语在意图i上出现的次数,记作Ni,即N0、N1、N2、…、Nn;其中P=N0+N1+N2+…+Nn,即
Figure PCTCN2016101921-appb-000002
然后统计词语出现次数,根据词语统计结果,计算出词语出现次数,即在语料中所有语句中出现的次数,词语记作w,则词语出现次数记作P;接着计算词语权重,词语出现次数越多,其作为意图的权重越小,例如,词语w0出现10词,词语w1出现100词,则w0词语权重比w1词语权重大,计算权重系数的方式:f(P)=1/Ln(P),Ln()是自然对数,例如:f(10)=0.434/f(100)=0.217,其中,计算权重系数的要求:既要使权重有区分,使其能够在意图概率计算中起作用,又不能使权重区分太大,避免权重小的词语变成无用词语,也可以对其进行一些优化调整,例如:f(P)=1/Ln(e+P),其中常数e=2.718281828459;根绝上述,计算词语意图概率值,计算公式为f(Wi)=(Ni/P)*(1/Ln(P))或表示为
Figure PCTCN2016101921-appb-000003
即意图概率值为词语意图比率*词语权重,例如:“软件”一词,在“寒暄语句”中出现1次,在“问答语句”中出现9次,则“寒暄意图”的比率为1/(1+9)=10%;“问答意图”的比率为9/(1+9)=90%,假设“软件”一词的权重1/Ln(p)=0.434,那么,“软件”的“寒暄意图”概率为10%*0.434,“软件”的“问答意图”概率为90%*0.434,这说明,当新的语句中出现 “软件”一词时,则语句是“问答”意图的可能性比较大;最后,形成意图模型,根据对词语的统计以及词语在各个意图的比率,计算出词语的意图概率值,生成意图模型,该数据模型可以存放在txt文件或者excel语句中,运行是可以存入内存中,最终结果形式如下表2所示:
表2
词语 意图 意图概率值
软件 问答 0.2286
软件 寒暄 0.0254
你好 问答 0.1062
你好 寒暄 0.2478
意图识别
1、用户录入自然语言语句
例如:下午好!
你今天忙不忙?
你们客户电话是多少?
2、数据预处理
该过程主要目的是过滤掉对意图识别无帮助的噪音部分,例如:开头或结尾的空格、~、#、&、制表符等。
3、意图计算
意图计算是本发明的最终目的,首先进行数据预处理,即语句预处理,,该过程主要目的是过滤对意图识别无帮助的噪音部分,例如:开头或结尾的空格、~、#、&、制表符等;再进行分词处理,利用中文分词工具把语句分解成一组词语,例如:宁夏/软件/升级/找/谁/?中文分词工具可以使用ansj分词、stanford分词、庖丁解牛等;获取词语意图概率值,词语的意 图概率值可以在上述“意图模型”中直接查询(例如上表2),记作Xi
然后计算出各个意图上的概率和,例如用户录入的语句有X、Y、Z三个词语,在意图0上的概率和为:G0=X0+Y0+Z0,在意图1上的概率和为:G1=X1+Y1+Z1,在意图2上的概率和为:G2=X2+Y2+Z2,这样就计算出在各个意图上的概率和,在此我们使用加法,在实际测试时发现,乘法效果更好,可以根据需要灵活选择;最后,取最大意图值,经过上述取值的累计和,我们得到了各个意图的概率值,根据概率模型的设计,取概率值最大的意图,是该语句的最终意图,得到该意图编号后,把意图编号转换成最终意图,例如,0代表寒暄意图,1代表问答意图。经过验证,系统对“寒暄、问答”的意图识别,准确率达到99.7%。
综上所述所述,本发明的最终目的是对用户交互信息的意图进行识别,首先收集语料并标注,对语料进行分词,并统计词语的意图概率值,得到概率模型,用户录入交互语句后,对用户语句进行分词,根据上述概率模型对词语意图概率值进行加权求和,得出整个语句的意图概率值,概率值最大的意图即为该语句的意图。
装置实施例一
图3是本发明实施例的语料处理装置的结构示意图,如图3所示,语料处理装置包括获取模块30、意图确定模块32、分词确定模块34、次数确定模块36和权重确定模块38,其中,
获取模块30,设置为获取所有或部分语料,作为语料集合;
意图确定模块32,设置为确定所述语料集合中每一条语料对应的意图;
分词确定模块34,设置为对语料集合中的每一条语料进行分词,确定每条语料中的词语;
次数确定模块36,设置为确定所述语料集合中每个词语出现的次数,以及用于确定每个词语在每个意图上出现的次数;
权重确定模块38,设置为根据所述语料集合中每个词语出现的次数和所述每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权 重。
其中,权重确定模块可以利用下述公式确定每个词语在每个意图上的权重F(Xi):F(Xi)=(Mi/P)*(1/Ln(P)),其中,其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在语料集合中出现的总次数,Ln是自然对数。
装置实施例二
图4是本发明实施例的语料分析装置的结构示意图,如图4所示,语料分析装置包括语料获取模块40、分词处理模块42、权重获取模块44、权重值确定模块46和意图处理模块48,其中:
语料获取模块40,设置为获取一条语料;
分词处理模块42,设置为对所述语料进行分词处理,确定所述语料中的每个词语;
权重获取模块44,设置为获取每个词语在每个意图上的权重;
权重值确定模块46,设置为根据所述每个词语在每个意图上的权重,确定每个意图的权重值;
意图处理模块48,设置为将大于或等于预定阈值的权重值对应的意图,确定为所述语料的意图。
其中,权重值确定模块具体设置为对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
综上所述,本发明使用概率模型,不需要收集用户点击行为数据和session数据,简单快捷,效率很高,且本发明主要针对问答系统中语句的意图,根据语句意图,更准确的回答用户问题,提高用户满意度。本发明通过简单的数据集训练,就能达到很好的识别效果,不需要用户点击记录、用户操作记录、session日志等信息,也不需要总结实体、特征词、句法格式。故本发明是一种简单实用、效率和识别率都很高的意图识别方法。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离 本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。
本领域那些技术人员可以理解,可以对实施例中的客户端中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个客户端中。可以把实施例中的模块组合成一个模块,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者客户端的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随 的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的加载有排序网址的客户端中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
工业实用性
如上所述,本发明实施例提供的一种语料处理方法和装置及语料分析 方法和装置具有以下有益效果:借助于本发明实施例的语料处理方法和装置及语料分析方法和装置,解决了现有技术中自动问答系统,无法满足用户需求,极大地影响了用户的满意度,降低了用户体验的问题,能够根据用户的交互信息,来分析用户的交流目的,即对用户的意图进行识别,以便对用户的问题有针对性的答复,满足了用户需求,提高了用户体验。

Claims (10)

  1. 一种语料处理方法,包括:
    获取所有或部分语料,作为语料集合;
    确定所述语料集合中每一条语料对应的意图;
    对语料集合中的每一条语料进行分词,确定每条语料中的词语;
    确定所述语料集合中每个词语出现的次数;
    确定每个词语在每个意图上出现的次数;
    根据所述语料集合中每个词语出现的次数和所述每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重。
  2. 如权利要求1所述的方法,其中,利用下述公式确定每个词语在每个意图上的权重F(Xi):
    F(Xi)=(Mi/P)*(1/Ln(P)),其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在所述语料集合中出现的总次数,Ln是自然对数。
  3. 如权利要求1或2所述的方法,其中,所述对语料集合中的每一条语料进行分词,确定每条语料中的词语的处理包括以下之一:ansj分词、stanford分词、庖丁解牛。
  4. 一种语料处理装置,包括:
    获取模块,设置为获取所有或部分语料,作为语料集合;
    意图确定模块,设置为确定所述语料集合中每一条语料对应的意图;
    分词确定模块,设置为对语料集合中的每一条语料进行分词,确定每条语料中的词语;
    次数确定模块,设置为确定所述语料集合中每个词语出现的次数,以及用于确定每个词语在每个意图上出现的次数;
    权重确定模块,设置为根据所述语料集合中每个词语出现的次数和所述每个词语在每个意图上出现的次数,确定每个词语在每个意图上的权重。
  5. 如权利要求4所述的装置,其中,利用下述公式确定每个词语在每个意图上的权重F(Xi):
    F(Xi)=(Mi/P)*(1/Ln(P)),其中,Xi表示词语,i表示词语的序号,i的取值范围是自然数,M表示意图,Mi表示Xi在意图M上出现的次数,P表示Xi在所述语料集合中出现的总次数,Ln是自然对数。
  6. 如权利要求4或5所述的装置,其中,所述对语料集合中的每一条语料进行分词,确定每条语料中的词语的处理包括以下之一:ansj分词、stanford分词、庖丁解牛。
  7. 一种语料分析方法,包括:
    获取一条语料;
    对所述语料进行分词处理,确定所述语料中的每个词语;
    获取每个词语在每个意图上的权重;
    根据所述每个词语在每个意图上的权重,确定每个意图的权重值;
    将大于或等于预定阈值的权重值对应的意图,确定为所述语料的意图。
  8. 如权利要求7所述的方法,其中,所述根据所述每个词语在每个意图上的权重,确定每个意图的权重值的处理包括:
    对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
  9. 一种语料分析装置,包括:
    语料获取模块,设置为获取一条语料;
    分词处理模块,设置为对所述语料进行分词处理,确定所述语料 中的每个词语;
    权重获取模块,设置为获取每个词语在每个意图上的权重;
    权重值确定模块,设置为根据所述每个词语在每个意图上的权重,确定每个意图的权重值;
    意图处理模块,设置为将大于或等于预定阈值的权重值对应的意图,确定为所述语料的意图。
  10. 如权利要求9所述的装置,其中,权重值确定模块具体设置为对于每一种意图,将每个词语在该意图上权重相加,作为该意图的权重值。
PCT/CN2016/101921 2015-10-27 2016-10-12 一种语料处理方法和装置及语料分析方法和装置 WO2017071474A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510705434.6A CN106610932A (zh) 2015-10-27 2015-10-27 一种语料处理方法和装置及语料分析方法和装置
CN201510705434.6 2015-10-27

Publications (1)

Publication Number Publication Date
WO2017071474A1 true WO2017071474A1 (zh) 2017-05-04

Family

ID=58615256

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/101921 WO2017071474A1 (zh) 2015-10-27 2016-10-12 一种语料处理方法和装置及语料分析方法和装置

Country Status (2)

Country Link
CN (1) CN106610932A (zh)
WO (1) WO2017071474A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110969016A (zh) * 2018-09-27 2020-04-07 普天信息技术有限公司 分词处理方法及装置
CN114328848A (zh) * 2022-03-16 2022-04-12 北京金山数字娱乐科技有限公司 文本处理方法及装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108304386A (zh) * 2018-03-05 2018-07-20 上海思贤信息技术股份有限公司 一种基于逻辑规则推断法律文书判决结果的方法及装置
CN108897869B (zh) * 2018-06-29 2020-10-27 北京百度网讯科技有限公司 语料标注方法、装置、设备和存储介质
CN109800296B (zh) * 2019-01-21 2022-03-01 四川长虹电器股份有限公司 一种基于用户真实意图的语意模糊识别方法
CN112101005B (zh) * 2020-04-02 2022-08-30 上海迷因网络科技有限公司 一种快速表达力测试题目生成和动态调整方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377245A (zh) * 2012-04-27 2013-10-30 腾讯科技(深圳)有限公司 一种自动问答方法及装置
CN104598445A (zh) * 2013-11-01 2015-05-06 腾讯科技(深圳)有限公司 自动问答系统和方法
CN104809103A (zh) * 2015-04-29 2015-07-29 北京京东尚科信息技术有限公司 一种人机对话的语义分析方法及系统
CN104951433A (zh) * 2015-06-24 2015-09-30 北京京东尚科信息技术有限公司 基于上下文进行意图识别的方法和系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3452558B2 (ja) * 2001-09-25 2003-09-29 インターナショナル・ビジネス・マシーンズ・コーポレーション 翻訳対象のリソースと分野別辞書を関連付けるための方法、システムおよびプログラム
CN103425635B (zh) * 2012-05-15 2018-02-02 北京百度网讯科技有限公司 一种答案推荐方法和装置
CN103838744B (zh) * 2012-11-22 2019-01-15 百度在线网络技术(北京)有限公司 一种查询词需求分析的方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377245A (zh) * 2012-04-27 2013-10-30 腾讯科技(深圳)有限公司 一种自动问答方法及装置
CN104598445A (zh) * 2013-11-01 2015-05-06 腾讯科技(深圳)有限公司 自动问答系统和方法
CN104809103A (zh) * 2015-04-29 2015-07-29 北京京东尚科信息技术有限公司 一种人机对话的语义分析方法及系统
CN104951433A (zh) * 2015-06-24 2015-09-30 北京京东尚科信息技术有限公司 基于上下文进行意图识别的方法和系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110969016A (zh) * 2018-09-27 2020-04-07 普天信息技术有限公司 分词处理方法及装置
CN110969016B (zh) * 2018-09-27 2023-06-23 普天信息技术有限公司 分词处理方法及装置
CN114328848A (zh) * 2022-03-16 2022-04-12 北京金山数字娱乐科技有限公司 文本处理方法及装置

Also Published As

Publication number Publication date
CN106610932A (zh) 2017-05-03

Similar Documents

Publication Publication Date Title
WO2017071474A1 (zh) 一种语料处理方法和装置及语料分析方法和装置
US11748416B2 (en) Machine-learning system for servicing queries for digital content
CN107341270B (zh) 面向社交平台的用户情感影响力分析方法
CN106980692B (zh) 一种基于微博特定事件的影响力计算方法
CN108073568B (zh) 关键词提取方法和装置
CN105573966B (zh) 电子表格中所呈现的内容的自适应修改
CN110619506B (zh) 一种岗位画像生成方法、岗位画像生成装置及电子设备
CN107862022B (zh) 文化资源推荐系统
WO2017167071A1 (zh) 一种对应用程序进行项目评估的方法及系统
CN108733816B (zh) 一种微博突发事件检测方法
CN108460082B (zh) 一种推荐方法及装置,电子设备
CN104750674B (zh) 一种人机会话满意度预测方法及系统
CN106682686A (zh) 一种基于手机上网行为的用户性别预测方法
EP3035210A1 (en) Method and device for obtaining web page category standards, and method and device for categorizing web page categories
CN104216964B (zh) 一种面向微博的非分词突发话题检测方法
CN107330079B (zh) 基于人工智能呈现辟谣信息的方法和装置
WO2016206557A1 (zh) 一种风险识别方法及装置
CN110019785B (zh) 一种文本分类方法及装置
CN110825868A (zh) 一种基于话题热度的文本推送方法、终端设备及存储介质
US20230367821A1 (en) Machine-learning system for servicing queries for digital content
CN110991742A (zh) 一种社交网络信息转发概率预测方法及系统
WO2022267325A1 (zh) 新闻热度计算方法、设备及存储介质
CN110309293A (zh) 文本推荐方法和装置
CN113392920B (zh) 生成作弊预测模型的方法、装置、设备、介质及程序产品
CN110019763B (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: 16858910

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

Country of ref document: EP

Kind code of ref document: A1