TWI803815B - Interactive natural language processing system and method thereof and computer readable medium - Google Patents

Interactive natural language processing system and method thereof and computer readable medium Download PDF

Info

Publication number
TWI803815B
TWI803815B TW110102126A TW110102126A TWI803815B TW I803815 B TWI803815 B TW I803815B TW 110102126 A TW110102126 A TW 110102126A TW 110102126 A TW110102126 A TW 110102126A TW I803815 B TWI803815 B TW I803815B
Authority
TW
Taiwan
Prior art keywords
text input
sentence pattern
module
dialogue script
sentence
Prior art date
Application number
TW110102126A
Other languages
Chinese (zh)
Other versions
TW202230200A (en
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 TW110102126A priority Critical patent/TWI803815B/en
Publication of TW202230200A publication Critical patent/TW202230200A/en
Application granted granted Critical
Publication of TWI803815B publication Critical patent/TWI803815B/en

Links

Images

Abstract

An interactive natural language processing system and method thereof for receiving, processing and reacting to text input of a user are provided. When the text input lacks required parameters, the system and the method can ask the user to supplement the parameters. When the text input is ambiguous, the system and the method can ask the user to confirm his or her intention. Therefore, the interactive natural language processing system and the method can still proceed to process the text input when the text input is unclear. The present invention further provides a computer-readable medium for performing the interactive natural language processing method.

Description

互動式自然語言處理系統、方法及電腦可讀媒介 Interactive natural language processing system, method and computer readable medium

本發明係有關一種自然語言處理技術,且特別係有關一種互動式自然語言處理系統、方法及電腦可讀媒介。 The present invention relates to a natural language processing technology, and in particular to an interactive natural language processing system, method and computer readable medium.

智慧型語音互動裝置的使用者,例如智慧型音箱的使用者,其口語指令常有模糊不清的情況。例如,當使用智慧型裝置聆聽音樂時,若使用者下達「劉德華」三個字的指令,由於該指令缺乏明確資訊而模糊不清,其意涵可能是指播放劉德華的音樂、查詢劉德華的資訊或播放劉德華的電影等多種可能性,因此常會使得裝置後端的自然語言處理系統無法理解。目前的技術針對這種模糊不清的指令通常無法理解,因此無法處理或處理效率及精確度較差。 Users of intelligent voice interaction devices, such as users of smart speakers, often have ambiguous spoken commands. For example, when using a smart device to listen to music, if the user gives an instruction of "Andy Lau", the instruction is vague due to the lack of clear information. Or playing Andy Lau's movies and other possibilities, so it often makes it impossible for the natural language processing system at the back end of the device to understand. Current technology is often unable to understand such ambiguous instructions, so it cannot be processed or processed with poor efficiency and accuracy.

為解決上述問題,本發明提供一種互動式自然語言處理系統,包括:意圖識別模組,用於判斷使用者之第一文字輸入在對話腳本中所對應之 句型,以根據該對話腳本之參數收集設定,判斷該第一文字輸入是否已包括該句型所需之全部參數,其中,當該第一文字輸入已包括該句型所需之全部參數,則該意圖識別模組觸發對應功能之執行,而當該第一文字輸入未包括該句型所需之全部參數,則該意圖識別模組觸發參數收集回問,以令該使用者提供第二文字輸入;以及參數收集模組,用於根據該第二文字輸入收集該句型所需且該第一文字輸入所缺乏之參數,以觸發該對應功能之執行。 In order to solve the above problems, the present invention provides an interactive natural language processing system, including: an intention recognition module, which is used to determine the corresponding input of the user's first text in the dialogue script. Sentence pattern, to judge whether the first text input has included all the parameters required by the sentence pattern according to the parameter collection setting of the dialogue script, wherein, when the first text input has included all the parameters required by the sentence pattern, then the The intent recognition module triggers the execution of the corresponding function, and when the first text input does not include all the parameters required by the sentence pattern, the intent recognition module triggers parameter collection and feedback to make the user provide a second text input; And a parameter collection module, which is used to collect parameters required by the sentence pattern and lacking in the first text input according to the second text input, so as to trigger the execution of the corresponding function.

在一實施例中,該互動式自然語言處理系統復包括:模糊語意回問模組,用於在該第一文字輸入於該對話腳本中無對應之句型時,根據該第一文字輸入中之關鍵字觸發模糊語意回問,以令該使用者提供第三文字輸入,進而確認該使用者之意圖是否為該關鍵字在該對話腳本中所對應之意圖 In one embodiment, the interactive natural language processing system further includes: a fuzzy semantic questioning module, which is used to answer questions based on key words in the first text input when there is no corresponding sentence pattern in the dialogue script for the first text input. Words trigger fuzzy semantic questions, so that the user can provide a third text input to confirm whether the user's intention is the corresponding intention of the keyword in the dialogue script

本發明另提供一種互動式自然語言處理方法,包括:判斷使用者之第一文字輸入在對話腳本中所對應之句型,以根據該對話腳本之參數收集設定,判斷該第一文字輸入是否已包括該句型所需之全部參數,其中,當該第一文字輸入已包括該句型所需之全部參數,則觸發對應功能之執行,而當該第一文字輸入未包括該句型所需之全部參數,則觸發參數收集回問,以令該使用者提供第二文字輸入;以及自該第二文字輸入收集該句型所需且該第一文字輸入所缺乏之參數,以觸發該對應功能之執行。 The present invention also provides an interactive natural language processing method, including: judging the sentence pattern corresponding to the user's first text input in the dialogue script, and judging whether the first text input includes the sentence pattern according to the parameter collection setting of the dialogue script. All the parameters required by the sentence pattern, wherein, when the first text input has included all the parameters required by the sentence pattern, the execution of the corresponding function will be triggered, and when the first text input does not include all the parameters required by the sentence pattern, Then trigger parameter collection to ask the user to provide a second text input; and collect parameters required by the sentence pattern and lacking in the first text input from the second text input to trigger the execution of the corresponding function.

在一實施例中,該互動式自然語言處理方法復包括:若該第一文字輸入在該對話腳本中無對應之句型,則根據該第一文字輸入中之關鍵字觸發模糊語意回問,以令該使用者提供第三文字輸入,進而確認該使用者之意圖是否為該關鍵字在該對話腳本中所對應之意圖。 In one embodiment, the interactive natural language processing method further includes: if the first text input has no corresponding sentence pattern in the dialogue script, triggering a vague semantic question according to the keyword in the first text input, so that The user provides a third text input to confirm whether the user's intention is the intention corresponding to the keyword in the dialogue script.

本發明復提供一種電腦可讀媒介,應用於計算裝置或電腦中,係儲存有指令,以執行上述之互動式自然語言處理方法。 The present invention further provides a computer-readable medium, which is used in a computing device or a computer and stores instructions to execute the above-mentioned interactive natural language processing method.

本發明的互動式自然語言處理系統、方法及電腦可讀媒介係處理使用者的指令的文字輸入,直接處理使用者明確的指令,使用互動方式收集使用者的指令缺乏的參數,並且使用互動方式確認模糊不清的指令的意圖,以快速且精準地解決指令難以理解而無法執行的問題。 The interactive natural language processing system, method and computer-readable medium of the present invention process the text input of the user's command, directly process the user's clear command, use the interactive method to collect the parameters that the user's command lacks, and use the interactive method Confirm the intent of ambiguous commands to quickly and accurately resolve problems where commands are difficult to understand and cannot be executed.

10:互動式自然語言處理系統 10: Interactive natural language processing system

12:輸入介面 12: Input interface

14:輸出介面 14: Output interface

40:決策樹 40: Decision Trees

42:根節點 42: root node

44,46:節點 44,46: node

100:前處理模組 100: Pre-processing module

110:符號處理模組 110:Symbol processing module

120:分詞模組 120: word segmentation module

130:參數貼標模組 130: Parameter labeling module

140:對話管理模組 140:Dialog management module

200:意圖識別模組 200: Intent recognition module

210:同義詞還原模組 210: Synonym restoration module

220:相似度計算模組 220: Similarity calculation module

230:句型競爭模組 230: Sentence pattern competition module

300:參數收集模組 300: parameter collection module

310:參數識別模組 310: Parameter identification module

320:參數回問模組 320: Parameter reply module

400:模糊語意回問模組 400: Fuzzy Semantic Response Module

500:對話腳本編輯模組 500: Dialogue script editing module

S21~S33:方法步驟 S21 ~ S33: method steps

圖1為根據本發明一實施例的一種互動式自然語言處理系統的方塊圖。 FIG. 1 is a block diagram of an interactive natural language processing system according to an embodiment of the present invention.

圖2為根據本發明一實施例的一種互動式自然語言處理方法的流程圖。 FIG. 2 is a flowchart of an interactive natural language processing method according to an embodiment of the present invention.

圖3為根據本發明一實施例的決策樹示意圖。 Fig. 3 is a schematic diagram of a decision tree according to an embodiment of the present invention.

以下藉由特定的具體實施例說明本發明之實施方式,在本技術領域具有通常知識者可由本說明書所揭示之內容輕易地瞭解本發明之其他優點及功效。 The implementation of the present invention will be described below through specific specific examples. Those with ordinary knowledge in the technical field can easily understand other advantages and effects of the present invention from the contents disclosed in this specification.

圖1為根據本發明一實施例的一種互動式自然語言處理系統10的方塊圖。互動式自然語言處理系統10係用於處理並回應使用者的指令。在一實施例中,互動式自然語言處理系統10包括輸入介面12、前處理模組100、意圖識別模組200、參數收集模組300、模糊語意回問模組400、對話腳 本編輯模組500及輸出介面14;前處理模組100包括符號處理模組110、分詞模組120、參數貼標模組130及對話管理模組140;意圖識別模組200包括同義詞還原模組210、相似度計算模組220及句型競爭模組230;參數收集模組300包括參數識別模組310及參數回問模組320;輸入介面12、符號處理模組110、分詞模組120、參數貼標模組130及對話管理模組140依序通信連接;同義詞還原模組210及參數識別模組310均通信連接對話管理模組140;同義詞還原模組210、相似度計算模組220及句型競爭模組230依序通信連接;參數回問模組320通信連接參數識別模組310;模糊語意回問模組400通信連接句型競爭模組230及參數回問模組320;輸出介面14通信連接模糊語意回問模組400;同義詞還原模組210、相似度計算模組220、參數回問模組320及模糊語意回問模組400均通信連接對話腳本編輯模組500。 FIG. 1 is a block diagram of an interactive natural language processing system 10 according to an embodiment of the present invention. The interactive natural language processing system 10 is used for processing and responding to user's instructions. In one embodiment, the interactive natural language processing system 10 includes an input interface 12, a pre-processing module 100, an intention recognition module 200, a parameter collection module 300, a fuzzy semantic questioning module 400, and a dialog script The editing module 500 and the output interface 14; the pre-processing module 100 includes a symbol processing module 110, a word segmentation module 120, a parameter labeling module 130 and a dialogue management module 140; the intent recognition module 200 includes a synonym restoration module 210, similarity calculation module 220 and sentence pattern competition module 230; parameter collection module 300 includes parameter identification module 310 and parameter answering module 320; input interface 12, symbol processing module 110, word segmentation module 120, The parameter labeling module 130 and the dialog management module 140 are sequentially connected by communication; the synonym restoration module 210 and the parameter recognition module 310 are all communicatively connected to the dialog management module 140; the synonym restoration module 210, the similarity calculation module 220 and the The sentence pattern competition module 230 is sequentially connected by communication; the parameter reply module 320 is connected by communication to the parameter identification module 310; the fuzzy semantic reply module 400 is connected by communication with the sentence pattern competition module 230 and the parameter reply module 320; the output interface 14 Communicatively connect the fuzzy semantic questioning module 400; the synonym restoration module 210, the similarity calculation module 220, the parameter questioning module 320 and the fuzzy semantic questioning module 400 are all connected to the dialog script editing module 500 by communication.

在一實施例中,輸入介面12用於接收使用者的指令的文字輸入;前處理模組100用於對文字輸入進行符號過濾,以濾除多餘的符號,接著進行分詞處理,然後再為分詞的結果其中的參數貼上標籤;意圖識別模組200用於對經過前處理模組100的文字輸入進行同義詞還原,然後與對話腳本中的各種句型進行相似度計算,挑選出多個候選句型後,就會進行句型競爭,競爭後會剩下最適合文字輸入的句型與相對應的語意,做為回應使用者的依據;參數收集模組300用於在指令的文字輸入缺少參數時,進行參數的識別、收集與回問,進而完成文字輸入的意圖理解;模糊語意回問模組400用於在文字輸入無法判斷出語意時回問使用者,以確認使用者的意圖;使用互動式自然語言處理系統10的人員可以通過對話腳本編輯模組500編輯對話腳本,該對話腳本為互動式自然語言處理系統10處理使用者的文字輸入的依據,編輯該對話腳本 可提高互動式自然語言處理系統10的語意理解能力,而且可針對不同應用進行互動式自然語言處理系統10的客製化;輸出介面14用於提供文字輸出以回應使用者的指令的文字輸入。 In one embodiment, the input interface 12 is used to receive the text input of the user's instruction; the pre-processing module 100 is used to perform symbol filtering on the text input to filter out redundant symbols, then perform word segmentation processing, and then divide the word Label the parameters in the results; the intent recognition module 200 is used to restore synonyms to the text input through the pre-processing module 100, and then perform similarity calculations with various sentence patterns in the dialogue script to select multiple candidate sentences After the competition, the sentence pattern competition will be carried out. After the competition, the most suitable sentence pattern for text input and the corresponding semantic meaning will be left as the basis for responding to the user; the parameter collection module 300 is used for lack of parameters in the text input of the command When performing parameter identification, collection and questioning, and then complete the understanding of the intention of the text input; the fuzzy semantic questioning module 400 is used to ask the user when the semantic meaning cannot be judged in the text input, so as to confirm the user's intention; use The personnel of the interactive natural language processing system 10 can edit the dialogue script through the dialogue script editing module 500, which is the basis for the interactive natural language processing system 10 to process the text input of the user, and edit the dialogue script The semantic understanding ability of the interactive natural language processing system 10 can be improved, and the interactive natural language processing system 10 can be customized for different applications; the output interface 14 is used to provide text output in response to the text input of the user's instruction.

圖1中之各模組均可為軟體、硬體或韌體;若為硬體,則可為具有資料處理與運算能力之處理單元、處理器、電腦或伺服器;若為軟體或韌體,則可包括處理單元、處理器、電腦或伺服器可執行之指令。 Each module in Figure 1 can be software, hardware or firmware; if it is hardware, it can be a processing unit, processor, computer or server with data processing and computing capabilities; if it is software or firmware , may include instructions executable by a processing unit, processor, computer or server.

圖2為根據本發明一實施例的一種互動式自然語言處理方法的流程圖。該互動式自然語言處理方法係由互動式自然語言處理系統10執行。以下配合圖2流程說明互動式自然語言處理系統10的各模組的功能與作用。 FIG. 2 is a flowchart of an interactive natural language processing method according to an embodiment of the present invention. The interactive natural language processing method is executed by the interactive natural language processing system 10 . The functions and effects of each module of the interactive natural language processing system 10 will be described below with reference to the flowchart in FIG. 2 .

首先,在步驟S21,輸入介面12接收使用者的指令的文字輸入。 First, in step S21 , the input interface 12 receives the text input of the user's instruction.

在步驟S22,符號處理模組110對文字輸入進行符號過濾,以濾除無關於語意及參數的符號,例如括弧、標點符號與空白等等,使後端模組不受到這些符號的影響。 In step S22, the symbol processing module 110 performs symbol filtering on the text input to filter out symbols irrelevant to semantics and parameters, such as brackets, punctuation marks, and blanks, so that the back-end module will not be affected by these symbols.

在步驟S23,分詞模組120對文字輸入進行分詞處理,以將文字輸入分解為具有最小的詞彙意義的單詞。例如,「葡萄」不可以分成「葡」與「萄」,因為這兩字拆開後並沒有獨自的意義;而「大安森林公園」可以分成「大安」、「森林」與「公園」,因為這些單詞分開後仍有各自的意義。在一實施例中,分詞技術分為詞典式、統計式與混合式,較佳地,本實施例使用混合式技術進行文字輸入的分詞處理。 In step S23, the word segmentation module 120 performs word segmentation processing on the text input to decompose the text input into words with the smallest lexical meaning. For example, "Grape" cannot be divided into "泉" and "糖", because the two characters have no independent meaning after being separated; and "Da'an Forest Park" can be divided into "Da'an", "Forest" and "Park", because These words still have their own meanings after they are separated. In one embodiment, the word segmentation technology is divided into dictionary type, statistical type and hybrid type. Preferably, this embodiment uses the hybrid type technology for word segmentation processing of text input.

接著,在步驟S24,參數貼標模組130在上述單詞中識別已知的參數,並將單詞中的參數貼上標籤,以標示參數的類別。在一實施例中,標籤的類別(即參數的類別)可包括人名、地名、組織與國家。例如,「大安森林 公園」分詞後的結果為「大安」、「森林」與「公園」,參數識別後,其中「大安」會被貼上類別為地名的標籤。參數貼標模組130也可以依據使用者需求擴充其標籤的類別。在一實施例中,參數識別與貼標技術分為詞典式、統計式與混合式,較佳地,本實施例使用詞典式技術進行參數的識別與貼標。 Next, in step S24 , the parameter labeling module 130 identifies known parameters in the above words, and labels the parameters in the words to indicate the category of the parameters. In an embodiment, the category of tags (ie, the category of parameters) may include person names, place names, organizations and countries. For example, "Daan Forest The result of the word segmentation of Park is "Da'an", "Forest" and "Park". After the parameters are identified, "Da'an" will be labeled as a place name. The parameter labeling module 130 can also expand the categories of its labels according to user needs. In one embodiment, the parameter identification and labeling techniques are divided into dictionary, statistical and hybrid. Preferably, this embodiment uses the dictionary technique for parameter identification and labeling.

接著,在步驟S25,對話管理模組140判斷互動式自然語言處理系統10是否處於參數收集狀態。初始的互動式自然語言處理系統10並非處於參數收集狀態,若使用者的文字輸入缺乏參數或語意模糊,則會觸發參數收集狀態。若互動式自然語言處理系統10並非處於參數收集狀態,則流程進入步驟S26以進行文字輸入的語意識別;若互動式自然語言處理系統10正處於參數收集狀態,則流程進入步驟S32以進行參數收集。 Next, in step S25, the dialog management module 140 determines whether the interactive natural language processing system 10 is in the parameter collection state. The initial interactive natural language processing system 10 is not in the parameter collection state. If the user's text input lacks parameters or the meaning is vague, the parameter collection state will be triggered. If the interactive natural language processing system 10 is not in the parameter collection state, then the flow process enters step S26 to carry out semantic recognition of text input; if the interactive natural language processing system 10 is in the parameter collection state, then the flow process enters step S32 to perform parameter collect.

在步驟S26,同義詞還原模組210對經過前處理模組100的文字輸入進行同義詞還原,以將上述單詞中的同義詞還原為原始詞。在一實施例中,同義詞還原模組210可包括一個儲存同義詞與其對應的原始詞的詞庫,例如表1的詞庫。若使用者的文字輸入經過分詞處理後有「阿蜜特」、「的」及「歌曲」這三個單詞,經過同義詞還原後,「阿蜜特」及「歌曲」這兩個同義詞會被還原為對應的原始詞,於是會變成「張惠妹」、「的」及「歌」這三個單詞。 In step S26 , the synonym restoration module 210 restores synonyms to the text input through the preprocessing module 100 , so as to restore the synonyms in the above words to the original words. In one embodiment, the synonym recovery module 210 may include a thesaurus storing synonyms and their corresponding original words, such as the thesaurus in Table 1. If the user's text input contains the three words "Amit", "De" and "Song" after word segmentation, after the synonyms are restored, the two synonyms "Amit" and "Song" will be restored is the corresponding original word, so it will become the three words "Zhang Huimei", "de" and "song".

Figure 110102126-A0101-12-0006-1
Figure 110102126-A0101-12-0006-1

接著,在步驟S27,相似度計算模組220將經過同義詞還原模組210還原的文字輸入與對話腳本中的每一個句型進行相似度計算,並選出相似度高於預設的門檻值的句型,其中,每個句型均為包含多個單詞的集合。例如表2包括對話腳本中的四個句型與其對應的語意。本實施例的語意以中文表示,但不以此為限,在另一實施例中,可用其他語言或識別碼表示語意。 Next, in step S27, the similarity calculation module 220 calculates the similarity between the text input restored by the synonym restoration module 210 and each sentence pattern in the dialogue script, and selects sentences whose similarity is higher than the preset threshold value. type, wherein each sentence type is a set containing multiple words. For example, Table 2 includes four sentence patterns in the dialogue script and their corresponding semantics. The semantic meaning of this embodiment is expressed in Chinese, but not limited thereto. In another embodiment, the semantic meaning can be expressed in other languages or identification codes.

Figure 110102126-A0101-12-0007-2
Figure 110102126-A0101-12-0007-2

本實施例採用皮爾森相關係數(Pearson correlation coefficient)表示文字輸入與句型之間的相似度。相似度計算模組220可包括一個詞典,該詞典至少包括對話腳本中的所有句型的所有單詞。相似度計算模組220會根據該詞典將經過同義詞還原模組210的文字輸入向量化,以產生向量x,且根據該詞典將對話腳本中的每個句型向量化,以產生每個句型的向量y,再用下列的公式一到六計算文字輸入與每個句型的皮爾森相關係數p,若有任何句型的皮爾森相關係數p大於預設的門檻值,則被視為使用者可能的意圖(以下將這樣的句型稱為候選句型)。 In this embodiment, the Pearson correlation coefficient is used to represent the similarity between text input and sentence patterns. The similarity calculation module 220 may include a dictionary, which at least includes all words of all sentence types in the dialogue script. The similarity calculation module 220 will vectorize the text input of the synonym restoration module 210 according to the dictionary to generate a vector x , and vectorize each sentence pattern in the dialogue script according to the dictionary to generate each sentence pattern vector y , and then use the following formulas 1 to 6 to calculate the Pearson correlation coefficient p between the text input and each sentence pattern. If the Pearson correlation coefficient p of any sentence pattern is greater than the preset threshold value, it is considered to be used The possible intention of the reader (hereinafter such a sentence pattern is referred to as a candidate sentence pattern).

Figure 110102126-A0101-12-0007-3
Figure 110102126-A0101-12-0007-3

Figure 110102126-A0101-12-0007-4
Figure 110102126-A0101-12-0007-4

Figure 110102126-A0101-12-0008-5
Figure 110102126-A0101-12-0008-5

Figure 110102126-A0101-12-0008-6
Figure 110102126-A0101-12-0008-6

Figure 110102126-A0101-12-0008-7
Figure 110102126-A0101-12-0008-7

Figure 110102126-A0101-12-0008-8
Figure 110102126-A0101-12-0008-8

上述公式中,n為該詞典中的單詞數量,xy均為n維向量,其中每一維度對應該詞典中的一個單詞。若經過同義詞還原模組210的文字輸入包括該詞典中的某一單詞,則向量x中對應該單詞的維度x i 的值為1;若經過同義詞還原模組210的文字輸入不包括該詞典中的某一單詞,則向量x中對應該單詞的維度x i 的值為0。若對話腳本中的某一句型包括該詞典中的某一單詞,則該句型的向量y中對應該單詞的維度y i 的值為1;若對話腳本中的某一句型不包括該詞典中的某一單詞,則該句型的向量y中對應該單詞的維度y i 的值為0。u x 為向量x中的n個維度的平均值。u y 為向量y中的n個維度的平均值。 In the above formula, n is the number of words in the dictionary, x and y are n- dimensional vectors, and each dimension corresponds to a word in the dictionary. If the text input through the synonym restoration module 210 includes a certain word in the dictionary, the value of the dimension x i corresponding to the word in the vector x is 1; if the text input through the synonym restoration module 210 does not include in the dictionary A certain word of , then the value of the dimension x i corresponding to the word in the vector x is 0. If a certain sentence pattern in the dialogue script includes a certain word in the dictionary, the value of the dimension y i corresponding to the word in the vector y of the sentence pattern is 1; if a certain sentence pattern in the dialogue script does not include the word in the dictionary , then the value of the dimension y i corresponding to the word in the vector y of the sentence type is 0. u x is the average of the n dimensions in the vector x . u y is the average value of n dimensions in vector y .

接著,在步驟S28,當相似度計算模組220找出多個候選句型時,句型競爭模組230會使用決策樹對這多個候選句型進行競爭,並留下最適合的句型。例如圖3所示的決策樹40,決策樹40為二元樹,其中,根節點42對應一個條件,其底下有兩個分支「是」及「否」,分別對應文字輸入及/或一個句型是否符合該條件。該分支「是」底下有另一個節點44,節點44對應另一個條件,其底下同樣有兩個分支「是」及「否」,分別對應文字輸入及/或該句型是否符合該條件,依此類推。例如,節點42、44及46所對應的條件分別為「文字輸入與句型之間的相似度大於門檻值」、「文字輸入未使用同義詞」及「文字輸入未觸發參數收集狀態」。句型競爭模組230會用文字輸入和對話 腳本中每一個句型從決策樹40的根節點42開始比對,若文字輸入及/或該句型不符合根節點42的條件,則比對結束;若文字輸入及/或該句型符合根節點42的條件,則繼續向下,比對節點44的條件,依此類推。最後,經過最多分支「是」的候選句型與其對應的語意,就被選為使用者的文字輸入在對話腳本中所對應的句型和語意。 Then, in step S28, when the similarity calculation module 220 finds out a plurality of candidate sentence patterns, the sentence pattern competition module 230 will use a decision tree to compete with the plurality of candidate sentence patterns, and leave the most suitable sentence pattern . For example, the decision tree 40 shown in FIG. 3, the decision tree 40 is a binary tree, wherein the root node 42 corresponds to a condition, and there are two branches "yes" and "no" below it, corresponding to text input and/or a sentence type meets this condition. There is another node 44 under the branch "yes", and the node 44 corresponds to another condition, and there are also two branches "yes" and "no" under it, corresponding to text input and/or whether the sentence pattern meets the condition respectively, according to And so on. For example, the conditions corresponding to the nodes 42, 44 and 46 are respectively "the similarity between the text input and the sentence pattern is greater than the threshold value", "the text input does not use synonyms" and "the text input does not trigger the parameter collection state". Sentence competition module 230 can use text input and dialogue Each sentence pattern in the script begins to compare from the root node 42 of the decision tree 40, if the text input and/or the sentence pattern does not meet the conditions of the root node 42, then the comparison ends; if the text input and/or the sentence pattern meet the The condition of the root node 42 is then continued down, compared with the condition of the node 44, and so on. Finally, the candidate sentence pattern and its corresponding semantics that have gone through the most branches of "yes" are selected as the corresponding sentence pattern and semantics of the user's text input in the dialogue script.

接著,在步驟S29,句型競爭模組230判斷是否需要觸發互動式自然語言處理系統10的參數收集狀態。詳言之,句型競爭模組230會檢查使用者的文字輸入中已在步驟S24被識別的參數是否已包括文字輸入在對話腳本中所對應的句型的參數收集設定所需的全部參數。如果是,表示使用者的文字輸入已具有完整語意,則不需要觸發參數收集狀態;如果不是,表示使用者的文字輸入因缺乏參數而不具備完整語意,則句型競爭模組230觸發參數收集狀態,因此,處理使用者的下一次文字輸入時,流程會從步驟S25進入步驟S32,而非進入步驟S26。對話腳本中的參數收集設定包括各句型所需的每一個參數的類別,句型競爭模組230會比對文字輸入所對應的句型所需的參數的類別以及文字輸入中的參數的類別,以判斷文字輸入中已被識別的參數是否已包括文字輸入所對應的句型所需的全部參數。 Next, in step S29 , the sentence pattern competition module 230 determines whether the parameter collection state of the interactive natural language processing system 10 needs to be triggered. Specifically, the sentence pattern competition module 230 checks whether the parameters identified in step S24 in the user's text input include all the parameters required for the parameter collection setting of the sentence pattern corresponding to the text input in the dialogue script. If yes, it means that the user's text input has complete semantics, and the parameter collection state does not need to be triggered; if not, it means that the user's text input does not have complete semantics due to lack of parameters, and the sentence pattern competition module 230 triggers parameter collection state, therefore, when processing the user's next text input, the flow will enter step S32 from step S25 instead of entering step S26. The parameter collection setting in the dialogue script includes the category of each parameter required by each sentence pattern, and the sentence pattern competition module 230 will compare the category of the parameter required by the sentence pattern corresponding to the text input and the category of the parameter in the text input , to determine whether the recognized parameters in the text input include all parameters required by the sentence pattern corresponding to the text input.

接著,在步驟S30,模糊語意回問模組400判斷是否觸發模糊語意回問。若相似度計算模組220在步驟S27找出至少一個候選句型(至少有一個句型的相似度大於門檻值),表示使用者的文字輸入有明確語意,則不需要觸發模糊語意回問。反之,若相似度計算模組220在步驟S27未找出候選句型(每一個句型的相似度均未超出門檻值),表示使用者的文字輸入語意模糊,則模糊語意回問模組400觸發模糊語意回問,在此情況下,使用者的下一次文 字輸入會被視為參數處理,因此,模糊語意回問模組400也會觸發參數收集狀態。 Next, in step S30, the vague semantic questioning module 400 determines whether to trigger the vague semantic questioning. If the similarity calculation module 220 finds at least one candidate sentence pattern in step S27 (the similarity of at least one sentence pattern is greater than the threshold value), it means that the user's text input has a clear semantic meaning, and there is no need to trigger the vague semantic question. Conversely, if the similarity calculation module 220 does not find candidate sentence patterns in step S27 (the similarity of each sentence pattern does not exceed the threshold value), it means that the semantic meaning of the user's text input is vague, then the vague semantic answering module 400 Trigger vague semantic questions. In this case, the user's next text Word input will be treated as a parameter, therefore, the fuzzy semantic answering module 400 will also trigger the parameter collection state.

接著,在步驟S31,輸出介面14提供文字輸出以回應使用者的文字輸入。若先前句型競爭模組230在步驟S29觸發參數收集狀態,則輸出介面14提供的文字輸出為參數收集回問,以令使用者提供參數。否則,若先前模糊語意回問模組400在步驟S30觸發模糊語意回問,則輸出介面14提供的文字輸出為模糊語意回問,以令使用者確認其意圖。若先前未觸發參數收集狀態,亦未觸發模糊語意回問,則輸出介面14提供的文字輸出為經過處理與正規化的使用者的指令。 Next, in step S31 , the output interface 14 provides text output in response to the user's text input. If the previous sentence pattern competition module 230 triggers the parameter collection state in step S29, the text output provided by the output interface 14 is a parameter collection reply, so that the user can provide parameters. Otherwise, if the fuzzy semantic question module 400 triggers the fuzzy semantic question in step S30 before, the text output provided by the output interface 14 is a fuzzy semantic question to make the user confirm his intention. If neither the parameter collection state nor the fuzzy semantic question is triggered before, the text output provided by the output interface 14 is the processed and normalized user instruction.

在另一實施例中,步驟S31之輸出介面14可在先前未觸發參數收集狀態且未觸發模糊語意回問時,執行文字輸入的語意所對應的功能,例如播放文字輸入所指定的音樂、歌曲或故事,以回應使用者的文字輸入。 In another embodiment, the output interface 14 of step S31 can execute the function corresponding to the semantic meaning of the text input, such as playing the music or song specified by the text input, when the parameter collection state is not triggered and the fuzzy semantic question is not triggered. or stories in response to user text input.

另一方面,在步驟S32,參數識別模組310會在經過前處理模組100處理後的文字輸入中進行參數的識別,若這一次的文字輸入中包含參數,且該參數的類別符合上一次的文字輸入所缺乏的參數的類別,則參數識別模組310收集該參數,以補充上一次的使用者的文字輸入,使其語意更完整。 On the other hand, in step S32, the parameter identification module 310 will identify the parameters in the text input processed by the pre-processing module 100, if the text input this time contains parameters, and the category of the parameters conforms to the last time If there is a type of parameter lacking in the text input by the user, the parameter recognition module 310 collects the parameter to supplement the text input by the user last time to make its semantics more complete.

接著,在步驟S33,參數回問模組320判斷上一次的文字輸入所缺乏的參數是否已全部收集。參數回問模組320可根據對話腳本中的參數收集設定,得知上一次的文字輸入是否仍有缺乏的參數。若缺乏的參數已全部收集,則參數回問模組320結束互動式自然語言處理系統10的參數收集狀態,因此,處理使用者的下一次文字輸入時,流程會從步驟S25進入步驟S26,而非 進入步驟S32。若缺乏的參數尚未全部收集,則參數回問模組320觸發參數收集回問。 Next, in step S33, the parameter query module 320 judges whether all the parameters lacking in the last text input have been collected. The parameter query module 320 can learn whether there are still missing parameters in the last text input according to the parameter collection settings in the dialogue script. If all the missing parameters have been collected, then the parameter answering module 320 ends the parameter collection state of the interactive natural language processing system 10. Therefore, when processing the user's next text input, the flow will enter step S26 from step S25, and No Go to step S32. If the missing parameters have not been collected yet, the parameter query module 320 triggers a parameter collection query.

接著,在步驟S30,模糊語意回問模組400仍會判斷是否觸發模糊語意回問。在步驟S31,輸出介面14提供文字輸出以回應使用者的文字輸入。若先前參數回問模組320在步驟S33觸發參數收集回問,則輸出介面14提供的文字輸出為參數收集回問,以令使用者提供參數。否則,若先前模糊語意回問模組400在步驟S30觸發模糊語意回問,則輸出介面14提供的文字輸出為模糊語意回問,以令使用者確認其意圖。若先前未觸發參數收集回問,亦未觸發模糊語意回問,則輸出介面14提供的文字輸出為經過處理與正規化的使用者的指令。 Next, in step S30, the vague semantic questioning module 400 still determines whether to trigger the vague semantic questioning. In step S31, the output interface 14 provides text output in response to the user's text input. If the previous parameter query module 320 triggers the parameter collection query in step S33, the text output provided by the output interface 14 is the parameter collection query, so that the user can provide parameters. Otherwise, if the fuzzy semantic question module 400 triggers the fuzzy semantic question in step S30 before, the text output provided by the output interface 14 is a fuzzy semantic question to make the user confirm his intention. If neither the parameter collection question nor the fuzzy semantic question is triggered before, the text output provided by the output interface 14 is the processed and normalized user instruction.

在另一實施例中,步驟S31之輸出介面14可在先前未觸發參數收集狀態且未觸發模糊語意回問時,執行文字輸入的語意所對應的功能,以回應使用者的文字輸入。 In another embodiment, the output interface 14 of step S31 can execute the function corresponding to the semantic meaning of the text input to respond to the text input of the user when the parameter collection state and the fuzzy semantic question are not triggered before.

在另一實施例中,輸入介面12可包括語音轉文字的功能,以將使用者的語音指令轉換為文字輸入,且輸出介面14可包括文字轉語音的功能,以將上述的參數收集回問及模糊語意回問從文字轉換為語音後輸出。 In another embodiment, the input interface 12 may include a speech-to-text function to convert the user's voice commands into text input, and the output interface 14 may include a text-to-speech function to collect the above-mentioned parameters and return them to the question. And fuzzy semantic questions are converted from text to voice and then output.

下面的實施例為說明互動式自然語言處理系統10如何識別使用者意圖與如何收集參數的範例。 The following embodiments are examples of how the interactive natural language processing system 10 recognizes user intent and collects parameters.

首先,在步驟S21,輸入介面12所接收的文字輸入為「我要聽三隻小豬的音樂」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120將文字輸入分成[我,要,聽,三隻小豬,的,音樂]這六個單詞。在步驟S24,參數貼標模組130將單詞中的參數貼上標籤,其結果 為[我,要,聽,三隻小豬@故事@音樂@成語,的,音樂],其中,單詞[三隻小豬]被識別為參數,且貼上了三個類別分別為故事、音樂及成語的標籤。在步驟S25,由於並未觸發參數收集狀態,因此對話管理模組140呼叫意圖識別模組200進行後續處理,換言之,流程自步驟S25進入步驟S26。 First, in step S21, the text input received by the input interface 12 is "I want to listen to the music of the Three Little Pigs". In step S22, the symbol processing module 110 performs symbol filtering on the text input. In step S23, the word segmentation module 120 divides the text input into six words [I, Want, Listen, The Three Little Pigs, , Music]. In step S24, the parameter labeling module 130 labels the parameters in the words, and the result For [I, want, listen, three little pigs@story@music@idiom, of, music], where the word [three little pigs] is recognized as a parameter, and three categories are labeled as story, music and idiom labels. In step S25, since the parameter collection state is not triggered, the dialog management module 140 calls the intention identification module 200 for subsequent processing, in other words, the process enters step S26 from step S25.

在步驟S26,同義詞還原模組210對[我,要,聽,三隻小豬@故事@音樂@成語,的,音樂]進行同義詞還原,所依據的詞庫如表1所示。因為文字輸入中沒有同義詞,所以結果不變。在步驟S27,相似度計算模組220根據詞典將文字輸入及對話腳本中的每一個句型向量化,其中,對話腳本如下列的表3所示,表3中每一列的句型對應同一列中的語意、參數收集設定及模糊語意回問設定,且表3中的意圖係指使用者的意圖,該意圖可涵蓋語意及句型。各句型及文字輸入的向量與其所依據的詞典如下列的表4所示,該詞典為[播放、張惠妹、的、歌、三隻小豬、聽、音樂、木偶奇遇記、故事、成語],共計10個單詞。 In step S26 , the synonym restoration module 210 restores synonyms for [I, want, listen, three little pigs@story@music@idiom, of,music] based on the thesaurus shown in Table 1. Because there are no synonyms in the text input, the result is unchanged. In step S27, the similarity calculation module 220 vectorizes each sentence pattern in the text input and dialogue script according to the dictionary, wherein the dialogue script is as shown in the following Table 3, and the sentence patterns in each column in Table 3 correspond to the same column The semantic meaning, parameter collection setting and fuzzy semantic question setting in Table 3, and the intention in Table 3 refers to the user's intention, which can cover semantic meaning and sentence pattern. The vectors of each sentence pattern and text input and the dictionary on which it is based are shown in the following table 4. The dictionary is [playing, Zhang Huimei, de, song, The Three Little Pigs, listening, music, Pinocchio, stories, idioms] , a total of 10 words.

Figure 110102126-A0101-12-0012-9
Figure 110102126-A0101-12-0012-9

Figure 110102126-A0101-12-0013-10
Figure 110102126-A0101-12-0013-10

然後,相似度計算模組220使用前述的公式一至六計算出各句型與文字輸入的變異數、標準差、共變異數及皮爾森相關係數,如下列的表5所示。 Then, the similarity calculation module 220 uses the aforementioned formulas 1 to 6 to calculate the variance, standard deviation, covariance and Pearson correlation coefficient of each sentence pattern and text input, as shown in Table 5 below.

Figure 110102126-A0101-12-0013-12
Figure 110102126-A0101-12-0013-12

由於相似度計算模組220會留下相似度(即皮爾森相關係數)高於門檻值的候選句型,若設定門檻值為0.5,則只有一個句型會成為候選句型,即相似度為0.612372的對話腳本中的第二個句型。 Since the similarity calculation module 220 will leave candidate sentence patterns whose similarity (i.e. Pearson correlation coefficient) is higher than the threshold value, if the threshold value is set to 0.5, then only one sentence pattern will become a candidate sentence pattern, that is, the similarity is 0.612372 second sentence pattern in dialogue script.

接著,在步驟S28,由於只有一個候選句型,所以不會有句型競爭,可直接判定使用者的意圖為播放音樂,但依據表3的對話腳本,可發現該意圖缺乏類別為歌手的參數,所以參數收集狀態會在步驟S29被觸發。 Then, in step S28, since there is only one candidate sentence pattern, there will be no sentence pattern competition, and it can be directly determined that the user's intention is to play music, but according to the dialogue script in Table 3, it can be found that the intention lacks the parameter of the category being a singer , so the parameter collection state will be triggered in step S29.

接著,在步驟S30,由於使用者的意圖已經明確,所以模糊語意回問不會被觸發。最後,在步驟S31,輸出介面14的文字輸出為播放音樂語意的參數收集回問句「你要聽誰的歌」。使用者看到或聽到互動式自然語言處理系統10回覆「你要聽誰的歌」後,可向互動式自然語言處理系統10輸入「張惠妹」作為下一次的文字輸入,然後互動式自然語言處理系統10會再度執行圖2的方法流程。 Next, in step S30, since the user's intention is already clear, the ambiguous semantic question will not be triggered. Finally, in step S31, the text output of the output interface 14 collects the question "whose song do you want to listen to" for the parameters of the playing music semantics. After the user sees or hears the interactive natural language processing system 10 replying "whose song do you want to listen to", he can input "Zhang Huimei" to the interactive natural language processing system 10 as the next text input, and then the interactive natural language processing system The system 10 will execute the method flow of FIG. 2 again.

首先,在步驟S21,輸入介面12所接收的文字輸入為「張惠妹」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120對過濾後的文字輸入進行分詞處理,張惠妹是一個完整的歌手名,所以不會再細分,分詞結果為[張惠妹]。在步驟S24,參數貼標模組130將分詞結果中的參數貼上標籤,其結果為[張惠妹@歌手],其中,單詞[張惠妹]被識別為參數,且貼上了類別為歌手的標籤。在步驟S25,由於互動式自然語言處理系統10的參數收集狀態已觸發,因此對話管理模組140呼叫參數收集模組300進行後續處理,換言之,流程自步驟S25進入步驟S32。 First, in step S21, the text input received by the input interface 12 is "Zhang Huimei". In step S22, the symbol processing module 110 performs symbol filtering on the text input. In step S23, the word segmentation module 120 performs word segmentation processing on the filtered text input. Zhang Huimei is a complete singer name, so it will not be further subdivided. The word segmentation result is [Zhang Huimei]. In step S24, the parameter labeling module 130 labels the parameters in the word segmentation result, and the result is [张惠妹@歌词], wherein the word [张惠妹] is recognized as a parameter, and the category is labeled singer. In step S25, since the parameter collection state of the interactive natural language processing system 10 has been triggered, the dialogue management module 140 calls the parameter collection module 300 for subsequent processing. In other words, the process enters step S32 from step S25.

接著,在步驟S32,參數識別模組310根據對話腳本可知當下需要收集類別為歌手的參數,且前處理模組100的處理結果為[張惠妹@歌手], 所以參數識別模組310會收集參數[張惠妹@歌手]。在步驟S33,參數回問模組320根據對話腳本可知缺乏的參數已經全部收集,換言之,上一次的文字輸入的語意已經補充完整,所以不會觸發參數收集回問,而是結束參數收集狀態,使下一次的流程會從步驟S25進入步驟S26。 Next, in step S32, the parameter recognition module 310 knows according to the dialogue script that the parameters whose category is a singer need to be collected at the moment, and the processing result of the pre-processing module 100 is [张惠妹@歌手], So the parameter identification module 310 will collect parameters [张惠妹@歌词]. In step S33, the parameter questioning module 320 knows from the dialog script that all missing parameters have been collected. In other words, the semantic meaning of the last text input has been completed, so the parameter collection questioning will not be triggered, but the parameter collection state will end. The next flow will enter step S26 from step S25.

接著,在步驟S30,由於缺乏的參數已經全部收集,且文字輸入的語意明確,所以模糊語意回問不會被觸發。最後,在步驟S31,輸出介面14提供的文字輸出為[播放音樂(聽張惠妹音樂)]的使用者意圖。在另一實施例中,輸出介面14可播放張惠妹的歌,以回應使用者的文字輸入。 Next, in step S30, since all missing parameters have been collected and the semantic meaning of the text input is clear, the vague semantic question will not be triggered. Finally, in step S31, the text output provided by the output interface 14 is the user intention of [play music (listen to Zhang Huimei's music)]. In another embodiment, the output interface 14 can play Zhang Huimei's song in response to the user's text input.

下面的實施例為說明互動式自然語言處理系統10如何進行模糊語意回問的範例。 The following embodiment is an example of how the interactive natural language processing system 10 performs fuzzy semantic questioning.

首先,在步驟S21,輸入介面12所接收的文字輸入為「張惠妹」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120對過濾後的文字輸入進行分詞處理,張惠妹是一個完整的歌手名,所以不會再細分,分詞結果為[張惠妹]。在步驟S24,參數貼標模組130將分詞結果中的參數貼上標籤,其結果為[張惠妹@歌手],其中,單詞[張惠妹]被識別為參數,且貼上了類別為歌手的標籤。在步驟S25,由於互動式自然語言處理系統10的參數收集狀態未被觸發,因此對話管理模組140呼叫意圖識別模組200進行後續處理,換言之,流程自步驟S25進入步驟S26。 First, in step S21, the text input received by the input interface 12 is "Zhang Huimei". In step S22, the symbol processing module 110 performs symbol filtering on the text input. In step S23, the word segmentation module 120 performs word segmentation processing on the filtered text input. Zhang Huimei is a complete singer name, so it will not be further subdivided. The word segmentation result is [Zhang Huimei]. In step S24, the parameter labeling module 130 labels the parameters in the word segmentation result, and the result is [张惠妹@歌词], wherein the word [张惠妹] is recognized as a parameter, and the category is labeled singer. In step S25, since the parameter collection state of the interactive natural language processing system 10 is not triggered, the dialog management module 140 calls the intention recognition module 200 for subsequent processing. In other words, the process enters step S26 from step S25.

接著,在步驟S26,請參見表1,由於文字輸入中沒有同義詞,所以同義詞還原模組210不會進行替換。在步驟S27,相似度計算模組220根據詞典將文字輸入及對話腳本中的每一個句型向量化,其中,本實施例的詞典 及對話腳本均與前面的實施例相同,對話腳本如表3所示,各句型及文字輸入的向量與其所依據的詞典如下列的表6所示。 Next, in step S26, please refer to Table 1, since there is no synonym in the text input, the synonym recovery module 210 will not replace it. In step S27, the similarity calculation module 220 vectorizes each sentence pattern in the text input and dialogue script according to the dictionary, wherein the dictionary of this embodiment And dialogue scripts are all the same as the previous embodiment, the dialogue scripts are shown in Table 3, and the vectors of each sentence pattern and text input and the dictionary on which they are based are shown in Table 6 below.

Figure 110102126-A0101-12-0016-13
Figure 110102126-A0101-12-0016-13

然後,相似度計算模組220使用前述的公式一至六計算出各句型與文字輸入的變異數、標準差、共變異數及皮爾森相關係數,如下列的表7所示。 Then, the similarity calculation module 220 uses the aforementioned formulas 1 to 6 to calculate the variance, standard deviation, covariance and Pearson correlation coefficient of each sentence pattern and text input, as shown in Table 7 below.

Figure 110102126-A0101-12-0016-15
Figure 110102126-A0101-12-0016-15

接著,相似度計算模組220檢查是否有相似度(皮爾森相關係數)超過門檻值的候選句型,本實施例的門檻值同樣為0.5,很明顯地,沒有相似度超過門檻值的候選句型。因此,在步驟S28及S29,由於沒有候選句型,所以句型競爭模組230不會有任何作用。 Then, the similarity calculation module 220 checks whether there is a candidate sentence pattern whose similarity (Pearson correlation coefficient) exceeds the threshold value. The threshold value of this embodiment is also 0.5. Obviously, there is no candidate sentence whose similarity exceeds the threshold value. type. Therefore, in steps S28 and S29, since there is no candidate sentence pattern, the sentence pattern competition module 230 will not have any effect.

接著,在步驟S30,由於使用者的文字輸入沒有任何意圖,所以模糊語意回問模組400會查詢文字輸入中是否有對話腳本中的模糊語意回問的關鍵字,在本實施例中,模糊語意回問模組400會發現[張惠妹]這個單詞就是關鍵字,因此觸發模糊語意回問及參數收集狀態,所以在步驟S31的文字輸出會是對話腳本中該關鍵字對應的回問句「你要聽她的歌嗎」,以令使用者確認其意圖是否為該關鍵字在對話腳本中所對應的意圖。使用者只需要回答「是」做為下一次流程的文字輸入,此文字輸入「是」將被視為參數,藉此,互動式自然語言處理系統10可確定使用者的意圖為該關鍵字所對應的意圖,即對話腳本中的第一種意圖。在該下一次流程的步驟S32,參數識別模組310可收集該參數並觸發預設的回應,例如在一實施例中,可觸發輸出介面14播放張惠妹的歌,以回應使用者的文字輸入。 Then, in step S30, since the user's text input has no intention, the fuzzy semantic answer module 400 will inquire whether there is a keyword of the fuzzy semantic answer in the dialogue script in the text input. The semantic questioning module 400 will find that the word [Zhang Huimei] is a keyword, so it triggers the fuzzy semantic questioning and parameter collection status, so the text output in step S31 will be the questioning sentence corresponding to the keyword in the dialogue script "you Do you want to listen to her song?" to allow users to confirm whether their intent is the intent corresponding to the keyword in the dialogue script. The user only needs to answer "yes" as the text input of the next process, and the text input "yes" will be regarded as a parameter, whereby the interactive natural language processing system 10 can determine that the user's intention is determined by the keyword The corresponding intent, which is the first intent in the dialogue script. In step S32 of the next process, the parameter identification module 310 can collect the parameter and trigger a preset response. For example, in one embodiment, the output interface 14 can be triggered to play Zhang Huimei's song in response to the user's text input.

此外,本發明還揭示一種電腦可讀媒介,係應用於具有處理器(例如,CPU、GPU等)及/或記憶體的計算裝置或電腦中,且儲存有指令,並可利用此計算裝置或電腦透過處理器及/或記憶體執行此電腦可讀媒介,以於執行此電腦可讀媒介時執行上述之方法及各步驟。 In addition, the present invention also discloses a computer-readable medium, which is applied to a computing device or computer having a processor (for example, CPU, GPU, etc.) and/or memory, and stores instructions, and can be used by this computing device or The computer executes the computer-readable medium through the processor and/or memory, so as to execute the above-mentioned method and each step when executing the computer-readable medium.

綜上所述,本發明提出的互動式自然語言處理系統、方法及電腦可讀媒介係使用下列三種行為來理解使用者的意圖。第一、當使用者直接傳達明確的指令時,本發明所提出的系統與方法可針對該指令進行正確的解譯, 進而找出正確的使用者意圖。第二、當使用者傳達缺乏參數的指令時,本發明所提出的系統與方法會進行互動式的回問,以令使用者提供缺乏的參數。第三、當使用者傳遞模糊不清的指令時,本發明所提出的系統與方法會針對指令中的關鍵字進行反問,以確認使用者的意圖。以上三種行為可用以正確理解使用者的指令,以快速且精準地解決指令難以理解的問題,進而提升使用者的滿意度。 To sum up, the interactive natural language processing system, method and computer readable medium proposed by the present invention use the following three behaviors to understand the user's intention. First, when the user directly conveys a clear instruction, the system and method proposed by the present invention can correctly interpret the instruction, Then find the correct user intent. Second, when the user transmits an instruction lacking parameters, the system and method proposed by the present invention will perform an interactive question to make the user provide the lacking parameters. Thirdly, when the user sends an ambiguous instruction, the system and method proposed by the present invention will ask the keyword in the instruction to confirm the user's intention. The above three behaviors can be used to correctly understand the user's instructions to quickly and accurately solve the problem of incomprehensible instructions, thereby improving user satisfaction.

上述實施例僅例示性說明本發明之原理及功效,而非用於限制本發明。任何在本技術領域具有通常知識者均可在不違背本發明之精神及範疇下,對上述實施例進行修飾與改變。因此,本發明之權利保護範圍,應如後述之申請專利範圍所列。 The above-mentioned embodiments are only illustrative to illustrate the principles and functions of the present invention, and are not intended to limit the present invention. Anyone with ordinary knowledge in the technical field can modify and change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the rights of the present invention should be listed in the scope of the patent application described later.

10:互動式自然語言處理系統 10: Interactive natural language processing system

12:輸入介面 12: Input interface

14:輸出介面 14: Output interface

100:前處理模組 100: Pre-processing module

110:符號處理模組 110:Symbol processing module

120:分詞模組 120: word segmentation module

130:參數貼標模組 130: Parameter labeling module

140:對話管理模組 140:Dialog management module

200:意圖識別模組 200: Intent recognition module

210:同義詞還原模組 210: Synonym restoration module

220:相似度計算模組 220: Similarity calculation module

230:句型競爭模組 230: Sentence pattern competition module

300:參數收集模組 300: parameter collection module

310:參數識別模組 310: Parameter identification module

320:參數回問模組 320: Parameter reply module

400:模糊語意回問模組 400: Fuzzy Semantic Response Module

500:對話腳本編輯模組 500: Dialogue script editing module

Claims (10)

一種互動式自然語言處理系統,包括:意圖識別模組,用於計算使用者之第一文字輸入及對話腳本中之各句型之間的相似度,以根據該相似度判斷該第一文字輸入在該對話腳本中是否有對應之句型或所對應之該句型,其中,若該對話腳本中沒有句型之該相似度大於門檻值,則該第一文字輸入在該對話腳本中無對應之句型,且該意圖識別模組復用於在該第一文字輸入於該對話腳本中存在對應之該句型時,根據該對話腳本之參數收集設定,判斷該第一文字輸入是否已包括該句型所需之全部參數,其中,當該第一文字輸入已包括該句型所需之全部參數,則該意圖識別模組觸發對應功能之執行,而當該第一文字輸入未包括該句型所需之全部參數,則該意圖識別模組觸發參數收集回問,以令該使用者提供第二文字輸入;參數收集模組,用於根據該第二文字輸入收集該句型所需且該第一文字輸入所缺乏之參數,以觸發該對應功能之執行;以及模糊語意回問模組,用於在該第一文字輸入於該對話腳本中無對應之句型時,查詢該第一文字輸入中是否存在該對話腳本中之關鍵字,且在該第一文字輸入中存在該關鍵字時,向該使用者輸出該關鍵字所對應之回問句,以令該使用者提供第三文字輸入,進而確認該使用者之意圖是否為該關鍵字在該對話腳本中所對應之意圖,其中,該回問句不包括該對話腳本中之任一句型。 An interactive natural language processing system, including: an intention recognition module, used to calculate the similarity between the user's first text input and each sentence pattern in the dialogue script, so as to judge the first text input in the Whether there is a corresponding sentence pattern or the corresponding sentence pattern in the dialogue script, wherein, if the similarity of no sentence pattern in the dialogue script is greater than the threshold value, then the first text input has no corresponding sentence pattern in the dialogue script , and the intent identification module is reused to determine whether the first text input includes the sentence pattern required by the first text input according to the parameter collection setting of the dialog script when the first text input has a corresponding sentence pattern in the dialogue script All the parameters, wherein, when the first text input includes all the parameters required by the sentence pattern, the intention recognition module triggers the execution of the corresponding function, and when the first text input does not include all the parameters required by the sentence pattern , then the intent recognition module triggers the parameter collection response, so that the user provides a second text input; the parameter collection module is used to collect the sentence pattern needed according to the second text input and the first text input lacks parameter, to trigger the execution of the corresponding function; and a fuzzy semantic answering module, used to inquire whether the first text input exists in the dialogue script when the first text input has no corresponding sentence pattern in the dialogue script keyword, and when the keyword exists in the first text input, output the answer sentence corresponding to the keyword to the user, so that the user can provide a third text input, and then confirm the user's intention Whether it is the intent corresponding to the keyword in the dialogue script, wherein the question sentence does not include any sentence pattern in the dialogue script. 如請求項1所述之互動式自然語言處理系統,復包括:前處理模組,用於將該第一文字輸入分解為具有最小詞彙意義之複數單詞,以供該意圖識別模組在判斷該第一文字輸入在該對話腳本中所對應之該句型之前,將該等單詞中之同義詞還原為對應之原始詞。 The interactive natural language processing system as described in Claim 1 further includes: a pre-processing module, used to decompose the first text input into plural words with the minimum lexical meaning, for the intention recognition module to judge the second A word is input before the corresponding sentence pattern in the dialogue script, and the synonyms in the words are restored to the corresponding original words. 如請求項1所述之互動式自然語言處理系統,復包括:前處理模組,用於將該第一文字輸入分解為具有最小詞彙意義之複數單詞,以供該意圖識別模組根據該等單詞計算該第一文字輸入及該對話腳本中之各該句型之間的該相似度。 The interactive natural language processing system as described in Claim 1, further comprising: a pre-processing module, used to decompose the first text input into plural words with minimum lexical meaning, for the intent recognition module to use the words according to the calculating the similarity between the first text input and the sentence patterns in the dialogue script. 如請求項3所述之互動式自然語言處理系統,其中,若該對話腳本中僅有一句型之該相似度大於該門檻值,則具有大於該門檻值之該相似度之該句型為該第一文字輸入在該對話腳本中所對應之該句型,若該對話腳本中有複數句型之該相似度大於該門檻值,則該意圖識別模組使用決策樹選取該等句型中之一者做為該第一文字輸入在該對話腳本中所對應之該句型。 The interactive natural language processing system as described in claim 3, wherein, if the similarity of the only sentence pattern in the dialogue script is greater than the threshold value, then the sentence pattern with the similarity greater than the threshold value is the The sentence pattern corresponding to the first text input in the dialogue script, if the similarity of plural sentence patterns in the dialogue script is greater than the threshold value, the intent recognition module uses a decision tree to select one of the sentence patterns Or as the first character input corresponding to the sentence pattern in the dialogue script. 如請求項1所述之互動式自然語言處理系統,復包括:前處理模組,用於將該第一文字輸入及該第二文字輸入分別分解為具有最小詞彙意義之複數單詞,且識別該等單詞中之參數及各該參數之類別,其中,該意圖識別模組係比對該參數收集設定中該句型所需之參數之類別以及該第一文字輸入之該等參數之類別,以判斷該第一文字輸入是否已包括該句型所需之全部參數,且該參數收集模組係根據該第二文字輸入之該等參數之類別,自該第二文字輸入收集該句型所需且該第一文字輸入所缺乏之參數。 The interactive natural language processing system as described in Claim 1 further includes: a pre-processing module, which is used to decompose the first text input and the second text input into plural words with the smallest lexical meaning, and recognize these The parameters in the word and the category of each parameter, wherein, the intention recognition module compares the category of the parameters required by the sentence pattern in the parameter collection setting and the category of the parameters of the first text input to determine the Whether the first text input has included all parameters required by the sentence pattern, and the parameter collection module is based on the category of the parameters of the second text input, collects the sentence pattern required by the second text input and the second text input A missing parameter for text input. 如請求項5所述之互動式自然語言處理系統,其中,該參數收集模組復用於在收集該句型所需且該第一文字輸入所缺乏之參數之後,根據該參數收集設定判斷該句型所需且該第一文字輸入所缺乏之參數是否已全部收集,若已全部收集,則由該參數收集模組觸發該對應功能之執行,否則,由該參數收集模組觸發該參數收集回問。 The interactive natural language processing system as described in claim 5, wherein the parameter collection module is reused to judge the sentence according to the parameter collection setting after collecting the parameters required by the sentence pattern and lacking in the first text input Whether the parameters required by the type and lacking in the first text input have all been collected, if all have been collected, the parameter collection module will trigger the execution of the corresponding function, otherwise, the parameter collection module will trigger the parameter collection response . 如請求項1所述之互動式自然語言處理系統,其中,該參數收集模組係用於在該第三文字輸入確認該使用者之意圖為該關鍵字在該對話腳本中所對應之意圖時,觸發該對應功能之執行。 The interactive natural language processing system as described in claim 1, wherein the parameter collection module is used to confirm that the user's intention is the intention corresponding to the keyword in the dialogue script when the third text input , to trigger the execution of the corresponding function. 一種互動式自然語言處理方法,包括:計算使用者之第一文字輸入及對話腳本中之各句型之間的相似度,以根據該相似度判斷該第一文字輸入在該對話腳本中是否有對應之句型或所對應之該句型,其中,若該對話腳本中沒有句型之該相似度大於門檻值,則該第一文字輸入在該對話腳本中無對應之句型;若該第一文字輸入在該對話腳本中存在對應之該句型時,根據該對話腳本之參數收集設定,判斷該第一文字輸入是否已包括該句型所需之全部參數;若該第一文字輸入已包括該句型所需之全部參數,則觸發對應功能之執行;若該第一文字輸入未包括該句型所需之全部參數,則觸發參數收集回問,以令該使用者提供第二文字輸入;自該第二文字輸入收集該句型所需且該第一文字輸入所缺乏之參數,以觸發該對應功能之執行;以及若該第一文字輸入在該對話腳本中無對應之句型,則查詢該第一文字輸入中是否存在該對話腳本中之關鍵字,且在該第一文字輸入中存在該關鍵字時,向該使用者輸出該關鍵字所對應之回問句,以令該使用者提供第三文字輸入,進而確認該使用者之意圖是否為該關鍵字在該對話腳本中所對應之意圖,其中,該回問句不包括該對話腳本中之任一句型。 An interactive natural language processing method, including: calculating the similarity between the user's first text input and each sentence pattern in the dialogue script, so as to judge whether the first text input has a corresponding correspondence in the dialogue script according to the similarity sentence pattern or the corresponding sentence pattern, wherein, if the similarity of no sentence pattern in the dialogue script is greater than the threshold value, then the first text input has no corresponding sentence pattern in the dialogue script; if the first text input is in When there is a corresponding sentence pattern in the dialogue script, according to the parameter collection setting of the dialogue script, it is judged whether the first text input has included all the parameters required by the sentence pattern; if the first text input has included the sentence pattern required All the parameters of the sentence pattern will trigger the execution of the corresponding function; if the first text input does not include all the parameters required by the sentence pattern, the parameter collection response will be triggered so that the user can provide the second text input; from the second text Input the parameters needed to collect the sentence patterns and the lack of the first text input to trigger the execution of the corresponding function; and if the first text input does not have a corresponding sentence pattern in the dialogue script, query whether the first text input There is a keyword in the dialogue script, and when the keyword exists in the first text input, output the answer sentence corresponding to the keyword to the user, so that the user can provide a third text input, and then confirm Whether the user's intention is the intention corresponding to the keyword in the dialogue script, wherein the question sentence does not include any sentence pattern in the dialogue script. 如請求項8所述之互動式自然語言處理方法,復包括: 將該第一文字輸入分解為具有最小詞彙意義之複數單詞,以在判斷該第一文字輸入在該對話腳本中所對應之該句型之前,將該等單詞中之同義詞還原為對應之原始詞。 The interactive natural language processing method as described in Claim 8, further comprising: Decomposing the first text input into plural words with minimum lexical meaning, so as to restore synonyms in these words to corresponding original words before judging the sentence pattern corresponding to the first text input in the dialogue script. 一種電腦可讀媒介,應用於計算裝置或電腦中,係儲存有指令,以執行如請求項8至9之任一者所述之互動式自然語言處理方法。 A computer-readable medium, used in a computing device or a computer, stores instructions to execute the interactive natural language processing method described in any one of Claims 8-9.
TW110102126A 2021-01-20 2021-01-20 Interactive natural language processing system and method thereof and computer readable medium TWI803815B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW110102126A TWI803815B (en) 2021-01-20 2021-01-20 Interactive natural language processing system and method thereof and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW110102126A TWI803815B (en) 2021-01-20 2021-01-20 Interactive natural language processing system and method thereof and computer readable medium

Publications (2)

Publication Number Publication Date
TW202230200A TW202230200A (en) 2022-08-01
TWI803815B true TWI803815B (en) 2023-06-01

Family

ID=83782374

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110102126A TWI803815B (en) 2021-01-20 2021-01-20 Interactive natural language processing system and method thereof and computer readable medium

Country Status (1)

Country Link
TW (1) TWI803815B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9342504B2 (en) * 1999-05-28 2016-05-17 Nant Holdings Ip, Llc Phrase-based dialogue modeling with particular application to creating a recognition grammar
TWM560646U (en) * 2018-01-05 2018-05-21 華南商業銀行股份有限公司 Voice control trading system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9342504B2 (en) * 1999-05-28 2016-05-17 Nant Holdings Ip, Llc Phrase-based dialogue modeling with particular application to creating a recognition grammar
TWM560646U (en) * 2018-01-05 2018-05-21 華南商業銀行股份有限公司 Voice control trading system

Also Published As

Publication number Publication date
TW202230200A (en) 2022-08-01

Similar Documents

Publication Publication Date Title
CN110895932B (en) Multi-language voice recognition method based on language type and voice content collaborative classification
KR102316063B1 (en) Method and apparatus for identifying key phrase in audio data, device and medium
CN107402913B (en) Method and device for determining antecedent
US7957968B2 (en) Automatic grammar generation using distributedly collected knowledge
CN107564528B (en) Method and equipment for matching voice recognition text with command word text
KR20180094664A (en) Method for information extraction from text data and apparatus therefor
CN110276080B (en) Semantic processing method and system
CN105117388A (en) Intelligent robot interaction system
CN114218375A (en) Dialogue guiding method, device, equipment and medium based on atlas
US11699435B2 (en) System and method to interpret natural language requests and handle natural language responses in conversation
CN111368145A (en) Knowledge graph creating method and system and terminal equipment
CN105956181A (en) Searching method and apparatus
TWI803815B (en) Interactive natural language processing system and method thereof and computer readable medium
CN115345177A (en) Intention recognition model training method and dialogue method and device
CN105302859A (en) Intelligent interaction system based on Internet
CN112685545A (en) Intelligent voice interaction method and system based on multi-core word matching
CN116483314A (en) Automatic intelligent activity diagram generation method
CN114266240A (en) Multi-intention identification method and device based on robot
CN114528851A (en) Reply statement determination method and device, electronic equipment and storage medium
CN114186020A (en) Semantic association method
TW202133027A (en) Dialogue system and method for human-machine cooperation
Lopes et al. From robust spoken language understanding to knowledge acquisition and management.
CN114818683B (en) Operation and maintenance method and device based on mobile terminal
CN111651348B (en) Debugging system of chat robot
CN115394288B (en) Language identification method and system for civil aviation multi-language radio land-air conversation