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 PDFInfo
- 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
Links
Images
Abstract
Description
本發明係有關一種自然語言處理技術,且特別係有關一種互動式自然語言處理系統、方法及電腦可讀媒介。 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
在一實施例中,輸入介面12用於接收使用者的指令的文字輸入;前處理模組100用於對文字輸入進行符號過濾,以濾除多餘的符號,接著進行分詞處理,然後再為分詞的結果其中的參數貼上標籤;意圖識別模組200用於對經過前處理模組100的文字輸入進行同義詞還原,然後與對話腳本中的各種句型進行相似度計算,挑選出多個候選句型後,就會進行句型競爭,競爭後會剩下最適合文字輸入的句型與相對應的語意,做為回應使用者的依據;參數收集模組300用於在指令的文字輸入缺少參數時,進行參數的識別、收集與回問,進而完成文字輸入的意圖理解;模糊語意回問模組400用於在文字輸入無法判斷出語意時回問使用者,以確認使用者的意圖;使用互動式自然語言處理系統10的人員可以通過對話腳本編輯模組500編輯對話腳本,該對話腳本為互動式自然語言處理系統10處理使用者的文字輸入的依據,編輯該對話腳本
可提高互動式自然語言處理系統10的語意理解能力,而且可針對不同應用進行互動式自然語言處理系統10的客製化;輸出介面14用於提供文字輸出以回應使用者的指令的文字輸入。
In one embodiment, the
圖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
首先,在步驟S21,輸入介面12接收使用者的指令的文字輸入。
First, in step S21 , the
在步驟S22,符號處理模組110對文字輸入進行符號過濾,以濾除無關於語意及參數的符號,例如括弧、標點符號與空白等等,使後端模組不受到這些符號的影響。
In step S22, the
在步驟S23,分詞模組120對文字輸入進行分詞處理,以將文字輸入分解為具有最小的詞彙意義的單詞。例如,「葡萄」不可以分成「葡」與「萄」,因為這兩字拆開後並沒有獨自的意義;而「大安森林公園」可以分成「大安」、「森林」與「公園」,因為這些單詞分開後仍有各自的意義。在一實施例中,分詞技術分為詞典式、統計式與混合式,較佳地,本實施例使用混合式技術進行文字輸入的分詞處理。
In step S23, the
接著,在步驟S24,參數貼標模組130在上述單詞中識別已知的參數,並將單詞中的參數貼上標籤,以標示參數的類別。在一實施例中,標籤的類別(即參數的類別)可包括人名、地名、組織與國家。例如,「大安森林
公園」分詞後的結果為「大安」、「森林」與「公園」,參數識別後,其中「大安」會被貼上類別為地名的標籤。參數貼標模組130也可以依據使用者需求擴充其標籤的類別。在一實施例中,參數識別與貼標技術分為詞典式、統計式與混合式,較佳地,本實施例使用詞典式技術進行參數的識別與貼標。
Next, in step S24 , the
接著,在步驟S25,對話管理模組140判斷互動式自然語言處理系統10是否處於參數收集狀態。初始的互動式自然語言處理系統10並非處於參數收集狀態,若使用者的文字輸入缺乏參數或語意模糊,則會觸發參數收集狀態。若互動式自然語言處理系統10並非處於參數收集狀態,則流程進入步驟S26以進行文字輸入的語意識別;若互動式自然語言處理系統10正處於參數收集狀態,則流程進入步驟S32以進行參數收集。
Next, in step S25, the
在步驟S26,同義詞還原模組210對經過前處理模組100的文字輸入進行同義詞還原,以將上述單詞中的同義詞還原為原始詞。在一實施例中,同義詞還原模組210可包括一個儲存同義詞與其對應的原始詞的詞庫,例如表1的詞庫。若使用者的文字輸入經過分詞處理後有「阿蜜特」、「的」及「歌曲」這三個單詞,經過同義詞還原後,「阿蜜特」及「歌曲」這兩個同義詞會被還原為對應的原始詞,於是會變成「張惠妹」、「的」及「歌」這三個單詞。
In step S26 , the
接著,在步驟S27,相似度計算模組220將經過同義詞還原模組210還原的文字輸入與對話腳本中的每一個句型進行相似度計算,並選出相似度高於預設的門檻值的句型,其中,每個句型均為包含多個單詞的集合。例如表2包括對話腳本中的四個句型與其對應的語意。本實施例的語意以中文表示,但不以此為限,在另一實施例中,可用其他語言或識別碼表示語意。
Next, in step S27, the
本實施例採用皮爾森相關係數(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
上述公式中,n為該詞典中的單詞數量,x及y均為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
接著,在步驟S28,當相似度計算模組220找出多個候選句型時,句型競爭模組230會使用決策樹對這多個候選句型進行競爭,並留下最適合的句型。例如圖3所示的決策樹40,決策樹40為二元樹,其中,根節點42對應一個條件,其底下有兩個分支「是」及「否」,分別對應文字輸入及/或一個句型是否符合該條件。該分支「是」底下有另一個節點44,節點44對應另一個條件,其底下同樣有兩個分支「是」及「否」,分別對應文字輸入及/或該句型是否符合該條件,依此類推。例如,節點42、44及46所對應的條件分別為「文字輸入與句型之間的相似度大於門檻值」、「文字輸入未使用同義詞」及「文字輸入未觸發參數收集狀態」。句型競爭模組230會用文字輸入和對話
腳本中每一個句型從決策樹40的根節點42開始比對,若文字輸入及/或該句型不符合根節點42的條件,則比對結束;若文字輸入及/或該句型符合根節點42的條件,則繼續向下,比對節點44的條件,依此類推。最後,經過最多分支「是」的候選句型與其對應的語意,就被選為使用者的文字輸入在對話腳本中所對應的句型和語意。
Then, in step S28, when the
接著,在步驟S29,句型競爭模組230判斷是否需要觸發互動式自然語言處理系統10的參數收集狀態。詳言之,句型競爭模組230會檢查使用者的文字輸入中已在步驟S24被識別的參數是否已包括文字輸入在對話腳本中所對應的句型的參數收集設定所需的全部參數。如果是,表示使用者的文字輸入已具有完整語意,則不需要觸發參數收集狀態;如果不是,表示使用者的文字輸入因缺乏參數而不具備完整語意,則句型競爭模組230觸發參數收集狀態,因此,處理使用者的下一次文字輸入時,流程會從步驟S25進入步驟S32,而非進入步驟S26。對話腳本中的參數收集設定包括各句型所需的每一個參數的類別,句型競爭模組230會比對文字輸入所對應的句型所需的參數的類別以及文字輸入中的參數的類別,以判斷文字輸入中已被識別的參數是否已包括文字輸入所對應的句型所需的全部參數。
Next, in step S29 , the sentence
接著,在步驟S30,模糊語意回問模組400判斷是否觸發模糊語意回問。若相似度計算模組220在步驟S27找出至少一個候選句型(至少有一個句型的相似度大於門檻值),表示使用者的文字輸入有明確語意,則不需要觸發模糊語意回問。反之,若相似度計算模組220在步驟S27未找出候選句型(每一個句型的相似度均未超出門檻值),表示使用者的文字輸入語意模糊,則模糊語意回問模組400觸發模糊語意回問,在此情況下,使用者的下一次文
字輸入會被視為參數處理,因此,模糊語意回問模組400也會觸發參數收集狀態。
Next, in step S30, the vague
接著,在步驟S31,輸出介面14提供文字輸出以回應使用者的文字輸入。若先前句型競爭模組230在步驟S29觸發參數收集狀態,則輸出介面14提供的文字輸出為參數收集回問,以令使用者提供參數。否則,若先前模糊語意回問模組400在步驟S30觸發模糊語意回問,則輸出介面14提供的文字輸出為模糊語意回問,以令使用者確認其意圖。若先前未觸發參數收集狀態,亦未觸發模糊語意回問,則輸出介面14提供的文字輸出為經過處理與正規化的使用者的指令。
Next, in step S31 , the
在另一實施例中,步驟S31之輸出介面14可在先前未觸發參數收集狀態且未觸發模糊語意回問時,執行文字輸入的語意所對應的功能,例如播放文字輸入所指定的音樂、歌曲或故事,以回應使用者的文字輸入。
In another embodiment, the
另一方面,在步驟S32,參數識別模組310會在經過前處理模組100處理後的文字輸入中進行參數的識別,若這一次的文字輸入中包含參數,且該參數的類別符合上一次的文字輸入所缺乏的參數的類別,則參數識別模組310收集該參數,以補充上一次的使用者的文字輸入,使其語意更完整。
On the other hand, in step S32, the
接著,在步驟S33,參數回問模組320判斷上一次的文字輸入所缺乏的參數是否已全部收集。參數回問模組320可根據對話腳本中的參數收集設定,得知上一次的文字輸入是否仍有缺乏的參數。若缺乏的參數已全部收集,則參數回問模組320結束互動式自然語言處理系統10的參數收集狀態,因此,處理使用者的下一次文字輸入時,流程會從步驟S25進入步驟S26,而非
進入步驟S32。若缺乏的參數尚未全部收集,則參數回問模組320觸發參數收集回問。
Next, in step S33, the
接著,在步驟S30,模糊語意回問模組400仍會判斷是否觸發模糊語意回問。在步驟S31,輸出介面14提供文字輸出以回應使用者的文字輸入。若先前參數回問模組320在步驟S33觸發參數收集回問,則輸出介面14提供的文字輸出為參數收集回問,以令使用者提供參數。否則,若先前模糊語意回問模組400在步驟S30觸發模糊語意回問,則輸出介面14提供的文字輸出為模糊語意回問,以令使用者確認其意圖。若先前未觸發參數收集回問,亦未觸發模糊語意回問,則輸出介面14提供的文字輸出為經過處理與正規化的使用者的指令。
Next, in step S30, the vague
在另一實施例中,步驟S31之輸出介面14可在先前未觸發參數收集狀態且未觸發模糊語意回問時,執行文字輸入的語意所對應的功能,以回應使用者的文字輸入。
In another embodiment, the
在另一實施例中,輸入介面12可包括語音轉文字的功能,以將使用者的語音指令轉換為文字輸入,且輸出介面14可包括文字轉語音的功能,以將上述的參數收集回問及模糊語意回問從文字轉換為語音後輸出。
In another embodiment, the
下面的實施例為說明互動式自然語言處理系統10如何識別使用者意圖與如何收集參數的範例。
The following embodiments are examples of how the interactive natural
首先,在步驟S21,輸入介面12所接收的文字輸入為「我要聽三隻小豬的音樂」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120將文字輸入分成[我,要,聽,三隻小豬,的,音樂]這六個單詞。在步驟S24,參數貼標模組130將單詞中的參數貼上標籤,其結果
為[我,要,聽,三隻小豬@故事@音樂@成語,的,音樂],其中,單詞[三隻小豬]被識別為參數,且貼上了三個類別分別為故事、音樂及成語的標籤。在步驟S25,由於並未觸發參數收集狀態,因此對話管理模組140呼叫意圖識別模組200進行後續處理,換言之,流程自步驟S25進入步驟S26。
First, in step S21, the text input received by the
在步驟S26,同義詞還原模組210對[我,要,聽,三隻小豬@故事@音樂@成語,的,音樂]進行同義詞還原,所依據的詞庫如表1所示。因為文字輸入中沒有同義詞,所以結果不變。在步驟S27,相似度計算模組220根據詞典將文字輸入及對話腳本中的每一個句型向量化,其中,對話腳本如下列的表3所示,表3中每一列的句型對應同一列中的語意、參數收集設定及模糊語意回問設定,且表3中的意圖係指使用者的意圖,該意圖可涵蓋語意及句型。各句型及文字輸入的向量與其所依據的詞典如下列的表4所示,該詞典為[播放、張惠妹、的、歌、三隻小豬、聽、音樂、木偶奇遇記、故事、成語],共計10個單詞。
In step S26 , the
然後,相似度計算模組220使用前述的公式一至六計算出各句型與文字輸入的變異數、標準差、共變異數及皮爾森相關係數,如下列的表5所示。
Then, the
由於相似度計算模組220會留下相似度(即皮爾森相關係數)高於門檻值的候選句型,若設定門檻值為0.5,則只有一個句型會成為候選句型,即相似度為0.612372的對話腳本中的第二個句型。
Since the
接著,在步驟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
首先,在步驟S21,輸入介面12所接收的文字輸入為「張惠妹」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120對過濾後的文字輸入進行分詞處理,張惠妹是一個完整的歌手名,所以不會再細分,分詞結果為[張惠妹]。在步驟S24,參數貼標模組130將分詞結果中的參數貼上標籤,其結果為[張惠妹@歌手],其中,單詞[張惠妹]被識別為參數,且貼上了類別為歌手的標籤。在步驟S25,由於互動式自然語言處理系統10的參數收集狀態已觸發,因此對話管理模組140呼叫參數收集模組300進行後續處理,換言之,流程自步驟S25進入步驟S32。
First, in step S21, the text input received by the
接著,在步驟S32,參數識別模組310根據對話腳本可知當下需要收集類別為歌手的參數,且前處理模組100的處理結果為[張惠妹@歌手],
所以參數識別模組310會收集參數[張惠妹@歌手]。在步驟S33,參數回問模組320根據對話腳本可知缺乏的參數已經全部收集,換言之,上一次的文字輸入的語意已經補充完整,所以不會觸發參數收集回問,而是結束參數收集狀態,使下一次的流程會從步驟S25進入步驟S26。
Next, in step S32, the
接著,在步驟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
下面的實施例為說明互動式自然語言處理系統10如何進行模糊語意回問的範例。
The following embodiment is an example of how the interactive natural
首先,在步驟S21,輸入介面12所接收的文字輸入為「張惠妹」。在步驟S22,符號處理模組110對文字輸入進行符號過濾。在步驟S23,分詞模組120對過濾後的文字輸入進行分詞處理,張惠妹是一個完整的歌手名,所以不會再細分,分詞結果為[張惠妹]。在步驟S24,參數貼標模組130將分詞結果中的參數貼上標籤,其結果為[張惠妹@歌手],其中,單詞[張惠妹]被識別為參數,且貼上了類別為歌手的標籤。在步驟S25,由於互動式自然語言處理系統10的參數收集狀態未被觸發,因此對話管理模組140呼叫意圖識別模組200進行後續處理,換言之,流程自步驟S25進入步驟S26。
First, in step S21, the text input received by the
接著,在步驟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
然後,相似度計算模組220使用前述的公式一至六計算出各句型與文字輸入的變異數、標準差、共變異數及皮爾森相關係數,如下列的表7所示。
Then, the
接著,相似度計算模組220檢查是否有相似度(皮爾森相關係數)超過門檻值的候選句型,本實施例的門檻值同樣為0.5,很明顯地,沒有相似度超過門檻值的候選句型。因此,在步驟S28及S29,由於沒有候選句型,所以句型競爭模組230不會有任何作用。
Then, the
接著,在步驟S30,由於使用者的文字輸入沒有任何意圖,所以模糊語意回問模組400會查詢文字輸入中是否有對話腳本中的模糊語意回問的關鍵字,在本實施例中,模糊語意回問模組400會發現[張惠妹]這個單詞就是關鍵字,因此觸發模糊語意回問及參數收集狀態,所以在步驟S31的文字輸出會是對話腳本中該關鍵字對應的回問句「你要聽她的歌嗎」,以令使用者確認其意圖是否為該關鍵字在對話腳本中所對應的意圖。使用者只需要回答「是」做為下一次流程的文字輸入,此文字輸入「是」將被視為參數,藉此,互動式自然語言處理系統10可確定使用者的意圖為該關鍵字所對應的意圖,即對話腳本中的第一種意圖。在該下一次流程的步驟S32,參數識別模組310可收集該參數並觸發預設的回應,例如在一實施例中,可觸發輸出介面14播放張惠妹的歌,以回應使用者的文字輸入。
Then, in step S30, since the user's text input has no intention, the fuzzy
此外,本發明還揭示一種電腦可讀媒介,係應用於具有處理器(例如,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)
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)
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 |
-
2021
- 2021-01-20 TW TW110102126A patent/TWI803815B/en active
Patent Citations (2)
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 |