TWI675365B - Grammar compiling system and grammar compiling method - Google Patents

Grammar compiling system and grammar compiling method Download PDF

Info

Publication number
TWI675365B
TWI675365B TW107111464A TW107111464A TWI675365B TW I675365 B TWI675365 B TW I675365B TW 107111464 A TW107111464 A TW 107111464A TW 107111464 A TW107111464 A TW 107111464A TW I675365 B TWI675365 B TW I675365B
Authority
TW
Taiwan
Prior art keywords
data
phrase
built
grammar
sentence template
Prior art date
Application number
TW107111464A
Other languages
Chinese (zh)
Other versions
TW201935462A (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 威盛電子股份有限公司
Publication of TW201935462A publication Critical patent/TW201935462A/en
Application granted granted Critical
Publication of TWI675365B publication Critical patent/TWI675365B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L15/00Speech recognition
    • G10L15/08Speech classification or search
    • G10L15/18Speech classification or search using natural language modelling
    • G10L15/1822Parsing for meaning understanding
    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L15/00Speech recognition
    • G10L15/08Speech classification or search
    • G10L15/18Speech classification or search using natural language modelling
    • G10L15/183Speech classification or search using natural language modelling using context dependencies, e.g. language models
    • G10L15/19Grammatical context, e.g. disambiguation of the recognition hypotheses based on word sequence rules

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Artificial Intelligence (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本發明提出一種語法編譯系統適用於自然語言。語法編譯系統包括編譯模組、輸入裝置以及處理器。編譯模組具有內建句式模板。內建句式模板包括多個形式參數。編譯模組為語法編譯平台。輸入裝置用以接收詞組資料以及語意資料。處理器耦接輸入裝置,並且用以執行編譯模組。當處理器執行編譯模組時,處理器讀取編譯模組當中的內建句式模板,並且將詞組資料以及語意資料與內建句式模板結合,以產生語法表達式資料。另外,一種語法編譯方法亦被提出。The invention proposes a syntax compiling system suitable for natural language. The syntax compiling system includes a compiling module, an input device, and a processor. The compilation module has a built-in sentence template. The built-in sentence template includes multiple formal parameters. The compilation module is a syntax compilation platform. The input device is used to receive phrase data and semantic data. The processor is coupled to the input device and is configured to execute a compilation module. When the processor executes the compilation module, the processor reads the built-in sentence template in the compilation module, and combines phrase data and semantic data with the built-in sentence template to generate grammatical expression data. In addition, a syntax compilation method is also proposed.

Description

語法編譯系統以及語法編譯方法Syntax compiling system and method

本發明是有關於一種語法編譯技術,且特別是有關於一種語法編譯系統以及語法編譯方法。 The invention relates to a syntax compiling technology, and in particular to a syntax compiling system and a syntax compiling method.

在智能語音辨識的應用領域中,自然語言理解(Natural Language Understanding,NLU)技術是目前重要的關鍵技術。自然語言理解技術能負責提取使用者語句中的關鍵信息,並且能判斷使用者的意圖,以對應於使用者的意圖執行後續處理。然而,在自然語言理解系統的建置過程中,自然語言理解系統需編譯語法規則來比對使用者語句中的關鍵信息。因此,為了使自然語言理解系統具有良好的理解功能,建置者需要編譯大量的語法規則,而導致在建置自然語言理解系統的過程中需要花費大量的時間成本。有鑑於此,以下將提出幾個範例實施例的解決方案。 In the field of intelligent speech recognition, Natural Language Understanding (NLU) technology is currently an important key technology. Natural language understanding technology can be responsible for extracting key information in user sentences, and can judge the user's intention to perform subsequent processing corresponding to the user's intention. However, in the process of building a natural language understanding system, the natural language understanding system needs to compile grammar rules to compare key information in user sentences. Therefore, in order for the natural language understanding system to have a good understanding function, the builder needs to compile a large number of grammatical rules, which results in a large amount of time cost in the process of building the natural language understanding system. In view of this, solutions of several exemplary embodiments will be proposed below.

本發明提供一種語法編譯系統以及語法編譯方法可有效率地產生語法表達式資料,並且語法表達式資料可用於產生多個語法規則資料。 The invention provides a grammar compilation system and a grammar compilation method which can efficiently generate grammatical expression data, and the grammatical expression data can be used to generate multiple grammar rule data.

本發明的一種語法編譯系統適用於自然語言。語法編譯系統包括編譯模組、輸入裝置以及處理器。編譯模組具有內建句式模板。內建句式模板包括多個形式參數。編譯模組為語法編譯平台。輸入裝置用以接收詞組資料以及語意資料。處理器耦接輸入裝置。處理器用以執行編譯模組。當處理器執行編譯模組時,處理器讀取編譯模組當中的內建句式模板,並且將詞組資料以及語意資料與內建句式模板結合,以產生語法表達式資料。 A syntax compiling system of the present invention is suitable for natural language. The syntax compiling system includes a compiling module, an input device, and a processor. The compilation module has a built-in sentence template. The built-in sentence template includes multiple formal parameters. The compilation module is a syntax compilation platform. The input device is used to receive phrase data and semantic data. The processor is coupled to the input device. The processor is used to execute a compilation module. When the processor executes the compilation module, the processor reads the built-in sentence template in the compilation module, and combines phrase data and semantic data with the built-in sentence template to generate grammatical expression data.

本發明的一種語法編譯方法適用於自然語言。語法編譯方法包括以下步驟。執行編譯模組,並且讀取編譯模組當中的內建句式模板,其中內建句式模板包括多個形式參數,並且編譯模組為語法編譯平台。接收詞組資料以及語意資料。將詞組資料以及語意資料與內建句式模板結合,以產生語法表達式資料。 A syntax compiling method of the present invention is applicable to natural language. The syntax compilation method includes the following steps. Run the compilation module and read the built-in sentence template in the compiled module. The built-in sentence template includes multiple formal parameters, and the compilation module is a syntax compilation platform. Receive phrase and semantic data. Combine phrase data and semantic data with built-in sentence templates to generate grammatical expression data.

基於上述,本發明的語法編譯系統以及語法編譯方法藉由在編譯模組中設定有內建句式模板,以使編譯模組可直接將使用者輸入的詞組資料以及語意資料與內建句式模板結合,以快速地產生語法表達式資料。因此,本發明的語法編譯系統以及語法編譯方法可有效節省編譯語法的工作量。 Based on the above, the grammar compiling system and grammar compiling method of the present invention have built-in sentence templates in the compilation module, so that the compilation module can directly input the phrase data, semantic data and built-in sentence patterns input by the user. Templates are combined to quickly generate grammatical expression data. Therefore, the syntax compiling system and the syntax compiling method of the present invention can effectively save the workload of compiling syntax.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。 In order to make the above features and advantages of the present invention more comprehensible, embodiments are hereinafter described in detail with reference to the accompanying drawings.

10‧‧‧語法編譯系統 10‧‧‧ Syntax Compilation System

100‧‧‧電子裝置 100‧‧‧ electronic device

110‧‧‧處理器 110‧‧‧ processor

120‧‧‧輸入裝置 120‧‧‧ input device

200‧‧‧外部伺服器 200‧‧‧ external server

210‧‧‧編譯模組 210‧‧‧ compile module

211‧‧‧內建句式模板 211‧‧‧built-in sentence template

212_1‧‧‧動詞性短語參數 212_1‧‧‧ Verb phrase parameters

212_2‧‧‧名詞性短語參數 212_2‧‧‧Nominal phrase parameters

220‧‧‧詞組資料 220‧‧‧ phrase data

221‧‧‧動詞詞組資料 221‧‧‧ Verb Phrase Information

222‧‧‧名詞詞組資料 222‧‧‧Noun Phrase Information

230‧‧‧語意資料 230‧‧‧ semantic data

240‧‧‧語法表達式資料 240‧‧‧ Syntax expression data

S310、S320、S330‧‧‧步驟 S310, S320, S330‧‧‧ steps

圖1繪示本發明的一實施例的語法編譯系統的示意圖。 FIG. 1 is a schematic diagram of a syntax compiling system according to an embodiment of the present invention.

圖2繪示本發明的一實施例的編譯模組的示意圖。 FIG. 2 is a schematic diagram of a compilation module according to an embodiment of the present invention.

圖3繪示本發明的一實施例的語法編譯方法的流程圖。 FIG. 3 is a flowchart of a syntax compiling method according to an embodiment of the present invention.

為了使本發明之內容可以被更容易明瞭,以下特舉實施例做為本發明確實能夠據以實施的範例。另外,凡可能之處,在圖式及實施方式中使用相同標號的元件/構件/步驟,係代表相同或類似部件。 In order to make the content of the present invention easier to understand, the following specific embodiments are examples based on which the present invention can be implemented. In addition, wherever possible, the same reference numbers are used in the drawings and embodiments to refer to the same or similar components.

圖1繪示本發明的一實施例的語法編譯系統的示意圖。在本實施例中,語法編譯系統10包括電子裝置100以及外部伺服器200。語法編譯系統10適用於自然語言理解(Natural Language Understanding,NLU),並且具有語法編譯的功能。電子裝置100包括處理器110以及輸入裝置120,並且處理器110耦接輸入裝置120。外部伺服器200包括編譯模組210。在本實施例中,電子裝置100可進一步包括有線通訊介面(interface)或無線通訊介面。電子裝置100以有線或無線的方式通訊連接至外部伺服器200,以讀取並且執行編譯模組210。編譯模組210為一種開放式的語法編譯平台。在本實施例中,處理器110可由輸入裝置120接收使用者 提供的詞組資料以及語意資料。編譯模組210包括內建句式模板。處理器110可讀取編譯模組210當中的內建句式模板,並且將詞組資料以及語意資料與內建句式模板結合,以產生語法表達式資料。 FIG. 1 is a schematic diagram of a syntax compiling system according to an embodiment of the present invention. In this embodiment, the syntax compiling system 10 includes an electronic device 100 and an external server 200. The syntax compiling system 10 is suitable for Natural Language Understanding (NLU) and has a function of syntax compiling. The electronic device 100 includes a processor 110 and an input device 120, and the processor 110 is coupled to the input device 120. The external server 200 includes a compilation module 210. In this embodiment, the electronic device 100 may further include a wired communication interface or a wireless communication interface. The electronic device 100 is communicatively connected to the external server 200 in a wired or wireless manner to read and execute the compilation module 210. The compilation module 210 is an open syntax compilation platform. In this embodiment, the processor 110 may receive the user from the input device 120. Phrase data and semantic data. The compilation module 210 includes a built-in sentence template. The processor 110 may read the built-in sentence template in the compilation module 210 and combine phrase data and semantic data with the built-in sentence template to generate grammatical expression data.

在本實施例中,電子裝置100可例如是個人電腦(Personal Computer,PC)、桌上型電腦(Desktop PC)、筆記型電腦(Notebook PC)、平板電腦(Tablet PC)等諸如此類的電腦裝置,本發明並不限於此。電子裝置100設置有無線或有線的通訊模組,以使電子裝置100藉由通訊模組與外部伺服器200進行通訊。舉例來說,當使用者操作語法編譯系統10時,使用者可操作電子裝置100,以藉由輸入裝置120輸入操作指令,以使電子裝置100可執行儲存在外部伺服器200當中的編譯模組210,以進行語法編譯工作。 In this embodiment, the electronic device 100 may be a computer device such as a personal computer (PC), a desktop PC, a notebook PC, a tablet PC, or the like, The invention is not limited to this. The electronic device 100 is provided with a wireless or wired communication module, so that the electronic device 100 communicates with the external server 200 through the communication module. For example, when the user operates the grammar compilation system 10, the user can operate the electronic device 100 to input operation instructions through the input device 120, so that the electronic device 100 can execute the compilation module stored in the external server 200 210 for syntax compilation.

在本實施例中,處理器110例如是中央處理單元(Central Processing Unit,CPU)、系統單晶片(System on Chip,SOC)或是其他可程式化之一般用途或特殊用途的微處理器(Microprocessor)、數位信號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuits,ASIC)、可程式化邏輯裝置(Programmable Logic Device,PLD)、其他類似處理裝置或這些裝置的組合。值得注意的是,在本實施例中,處理器110包括編譯器(Compiler),其中編譯器可用以執行本發明各實施所述的各種自然語言編譯工作。 In this embodiment, the processor 110 is, for example, a central processing unit (CPU), a system on chip (SOC), or other programmable general-purpose or special-purpose microprocessors. ), Digital Signal Processor (DSP), Programmable Controller, Application Specific Integrated Circuits (ASIC), Programmable Logic Device (PLD), other similar processing Device or a combination of these devices. It is worth noting that, in this embodiment, the processor 110 includes a compiler (Compiler), where the compiler can be used to perform various natural language compilation tasks described in the embodiments of the present invention.

在本實施例中,輸入裝置120可用以接收使用者輸入的 指令參數。輸入裝置120例如是鍵盤(Keyboard)、語音接收器(Voice receiver)、麥克風(Microphone)或這些裝置的組合等。輸入裝置120可用以接收使用者提供的語音信息或指令參數等,本發明並不加以限制。在本實施例中,輸入裝置120可依據上述各種型式的輸入方式來提供資料或參數至處理器110。 In this embodiment, the input device 120 may be used to receive user input. Instruction parameters. The input device 120 is, for example, a keyboard, a voice receiver, a microphone, or a combination of these devices. The input device 120 can be used to receive voice information or command parameters provided by a user, which is not limited in the present invention. In this embodiment, the input device 120 may provide data or parameters to the processor 110 according to the above-mentioned various types of input methods.

在本實施例中,外部伺服器200為雲端系統。外部伺服器200用以提供自然語言的語法編譯的應用程式介面(Application Programming Interface,API)。在本實施例中,電子裝置100可讀取外部伺服器200的編譯模組210,並且直接在外部伺服器200上執行編譯模組210。在一實施例中,電子裝置100也可先將編譯模組210下載至電子裝置100的記憶體中,再執行編譯模組210,本發明並不加以限定。 In this embodiment, the external server 200 is a cloud system. The external server 200 is used to provide a natural language syntax-compiled application programming interface (API). In this embodiment, the electronic device 100 can read the compilation module 210 of the external server 200 and execute the compilation module 210 directly on the external server 200. In an embodiment, the electronic device 100 may also download the compilation module 210 into the memory of the electronic device 100 before executing the compilation module 210, which is not limited in the present invention.

圖2繪示本發明的一實施例的編譯模組的示意圖。參考圖1以及圖2,編譯模組210包括內建句式模板211,並且內建句式模板211可例如是命令句式模板或控制句式模板,並且這些句式通常用於表示同樣語意的句子的不同句式,例如以下舉例所述的多個模板都是用於表示同樣語意的多個不同命令句式,但本發明並不限於此。內建句式模板211包括多個形式參數(formal parameter),並且這些形式參數包括動詞性短語參數212_1以及名詞性短語參數2122。然而,在內建句式模板211中的動詞性短語參數212_1以及名詞性短語參數212_2的數量本發明並不加以限制,並且內建句式模板211也不限於動詞參數或名詞參數。在本 實施例中,輸入裝置120提供詞組資料220以及語意資料230,以使編譯模組210將詞組資料220以及語意資料230與內建句式模板211結合,以產生語法表達式資料240。 FIG. 2 is a schematic diagram of a compilation module according to an embodiment of the present invention. Referring to FIG. 1 and FIG. 2, the compilation module 210 includes a built-in sentence template 211, and the built-in sentence template 211 may be, for example, a command sentence template or a control sentence template, and these sentences are generally used to represent the same semantic meaning. Different sentence patterns of the sentence, for example, multiple templates described in the following examples are multiple different command sentence patterns for expressing the same semantic meaning, but the present invention is not limited thereto. The built-in sentence template 211 includes a plurality of formal parameters, and these formal parameters include a verbal phrase parameter 212_1 and a nominal phrase parameter 2122. However, the number of verbal phrase parameters 212_1 and nominal phrase parameters 212_2 in the built-in sentence template 211 is not limited by the present invention, and the built-in sentence template 211 is not limited to verb parameters or noun parameters. In this In the embodiment, the input device 120 provides phrase data 220 and semantic data 230, so that the compilation module 210 combines the phrase data 220 and semantic data 230 with a built-in sentence template 211 to generate grammatical expression data 240.

在本實施例中,詞組資料220包括動詞詞組資料221以及名詞詞組資料222。動詞詞組資料220可包括多個動詞實際參數(actual parameter),並且名詞詞組資料可包括多個名詞實際參數,其中這些動詞實際參數與名詞實際參數通常用以表示同義詞的多個名詞或動詞。在本實施例中,語意資料230包括字符串資料,並且字符串資料包括修飾符號以及語意詞彙。在本實施例中,當處理器110將詞組資料220以及語意資料230與內建句式模板211組合,以產生語法表達式資料240時,處理器110將這些動詞實際參數的至少其中之一以及這些名詞實際參數的至少其中之一關聯於內建句式模板211中的這些形式參數,以產生語法表達式資料240。在本實施例中,語法表達式資料240可包括一個或多個語法表達式。因此,當處理器110執行自然語言理解操作時,處理器110可藉由語法表達式資料240來產生多個語法規則資料,並且藉由這些語法規則資料來比對語料資料,以取得對應於語料資料的語意資訊。 In this embodiment, the phrase data 220 includes verb phrase data 221 and noun phrase data 222. The verb phrase data 220 may include multiple verb actual parameters, and the noun phrase data may include multiple noun actual parameters, where these verb actual parameters and noun actual parameters are usually used to represent multiple nouns or verbs with synonyms. In this embodiment, the semantic data 230 includes character string data, and the character string data includes modifier symbols and semantic words. In this embodiment, when the processor 110 combines phrase data 220 and semantic data 230 with a built-in sentence template 211 to generate grammatical expression data 240, the processor 110 combines at least one of the actual parameters of these verbs and At least one of the actual parameters of these nouns is associated with the formal parameters in the built-in sentence template 211 to generate grammatical expression data 240. In this embodiment, the syntax expression data 240 may include one or more syntax expressions. Therefore, when the processor 110 performs a natural language understanding operation, the processor 110 may generate a plurality of grammatical rule data by using the grammatical expression data 240, and compare the corpus data with the grammatical rule data to obtain a corresponding Corpus data semantic information.

舉例來說,內建句式模板211例如包括以下多個模板。 For example, the built-in sentence template 211 includes the following multiple templates, for example.

第一模板為“<_基本句式:template>:[=動詞性短語,名詞性短語=][請]$(動詞性短語)$(名詞性短語)”。 The first template is "<_basic sentence pattern: template>: [= verbal phrase, noun phrase =] [Please] $ (verbal phrase) $ (noun phrase)".

第二模板為“<_把字句:template>:[=動詞性短語,名詞 性短語=][請]把$(名詞性短語)$(動詞性短語)”。 The second template is "<_ 把 词句 : template>: [= verbal phrase, noun Sexual Phrase =] [Please] put $ (noun phrase) $ (verbal phrase) ".

第三模板為“<_幫忙_動賓結構:template>:[=動詞性短語,名詞性短語=][請][幫]幫忙$(動詞性短語)$(名詞性短語)|$(名詞性短語)[請][幫]幫忙$(動詞性短語)|[請](幫[幫]|幫助)(我|俺)$(動詞性短語)$(名詞性短語)”|$(名詞性短語)[請](幫[幫]|幫助)(我|俺)$(動詞性短語)|[請](給|為)(我|俺)$(動詞性短語)$(名詞性短語)|$(名詞性短語)[請](給|為)(我|俺)$(動詞性短語)”。 The third template is "<_ 帮忙 _ 动 宾 struct: template>: [= verbal phrase, noun phrase =] [Please] [帮] 帮帮 $ (verbal phrase) $ (noun phrase) | $ (noun phrase) [Please] [帮] 帮帮 $ (verbal phrase) | [Please] (帮 [帮] | Help) (我 | 俺) $ (verbal phrase) $ (nominal Phrase) "| $ (Noun Phrase) [Please] (帮 [帮] | Help) (我 | $) $ (verbal phrase) | [Please] (Give | to) (我 | 俺) $ (Verbal phrase) $ (noun phrase) | $ (noun phrase) [please] (give | to) (我 | 俺) $ (verbal phrase) ".

以第一模板來說明,“<_基本句式:template>”表示一個模板的定義,其中“template”為關鍵字,並且這個模板名稱為“_基本句式”。“[=動詞性短語,名詞性短語=]”為這個模板的參數說明,這裡描述了兩個參數分別為動詞性短語以及名詞性短語。“[請]$(動詞性短語)$(名詞性短語)”為這個模板的定義體。符號“$”為關鍵字,並且用以表示引用形式參數。符號“|”用以表示為“或”。在此範例中,上述這些模板的語言符號的編譯內容是依據擴展巴科斯-瑙爾範式(Extended Backus-Naur Form,EBNF)的元語法(metalanguage)符號表示法來生成。 Take the first template for illustration, "<_basic sentence: template>" represents the definition of a template, where "template" is a keyword, and the name of this template is "_basic sentence". "[= Verbal phrase, nominal phrase =]" is the parameter description of this template, and the two parameters described here are verbal phrase and noun phrase. "[Please] $ (verbal phrase) $ (noun phrase)" is the definition of this template. The symbol "$" is a keyword and is used to refer to a formal parameter. The symbol "|" is used to indicate "or". In this example, the compiled contents of the language symbols of these templates are generated according to the metalanguage symbolic representation of the Extended Backus-Naur Form (EBNF).

因此,在此範例中,使用者可透過輸入裝置120來輸入詞組資料220以及語意資料230至編譯模組210。在此範例中,詞組資料220的內容可例如是“<動詞詞組1>:啟動|開啟|打開|開”以及“<名詞詞組1>:空調”。語意資料230包括字符串資料,並且字符串資料的內容可例如是“<{@=openconditioner}>”,其中 “@”為修飾符號,並且“openconditioner”為語意詞彙。在此範例中,編譯模組210可依據上述詞組資料220以及語意資料230來產生以下分別對應於上述的第一至第三模板的多個語法。 Therefore, in this example, the user can input the phrase data 220 and the semantic data 230 to the compilation module 210 through the input device 120. In this example, the content of the phrase data 220 may be, for example, "<verb phrase 1>: start | open | open | open | open | open | open" and "<noun phrase 1>: air conditioner". The semantic data 230 includes character string data, and the content of the character string data may be, for example, "<{@ = openconditioner}>", where "@" Is a modifier and "openconditioner" is a semantic word. In this example, the compiling module 210 can generate the following multiple grammars corresponding to the first to third templates respectively according to the phrase data 220 and semantic data 230.

第一語法為“<grammar_基本句式_1>:<_基本句式(<動詞詞組1>,<名詞詞組1>)><{@=openconditioner}>”。 The first grammar is "<grammar_basic sentence pattern_1>: <_ basic sentence pattern (<verb phrase 1>, <noun phrase 1>)> <{@ = openconditioner}>".

第二語法為“<grammar_把字句_1>:<_把字句(<動詞詞組1>,<名詞詞組1>)><{@=openconditioner}>”。 The second grammar is "<grammar_ 把 字句 _1>: <_ 把 字句 (<verb phrase1>, <noun phrase1>)> <{@ = openconditioner}>".

第三語法為“<grammar_幫忙_動賓結構_1>:<_幫忙_動賓結構(<動詞詞組1>,<名詞詞組1>)><{@=openconditioner}>”。 The third grammar is "<grammar_ 帮帮 _ 动 宾 结构 _1>: <_ 帮帮 _ 动 OB structure (<verb phrase 1>, <noun phrase 1>)> <{@ = openconditioner}>".

以第一語法來說明,“<grammar_基本句式_1>”為語法的名子。“<_基本句式(<動詞詞組1>,<名詞詞組1>)>”表示調用第一模板“<_基本句式>”,並且同時傳遞第一模板的實際參數分別為<動詞詞組1>以及<名詞詞組1>。“<@=openconditioner>”表示為一個修飾符(modifier)。也就是說,若第一語法與語料資料匹配後要輸出“openconditioner”來表示語義。 Take the first grammar as an example, "<grammar_basic sentence pattern 1>" is the name of the grammar. "<_Basic sentence pattern (<verb phrase 1>, <noun phrase 1>)>" means that the first template "<_basic sentence pattern>" is called, and the actual parameters passed to the first template at the same time are <verb phrase 1 > And <noun phrase 1>. "<@ = Openconditioner>" is represented as a modifier. That is, if the first grammar matches the corpus data, an "openconditioner" is output to represent the semantics.

因此,在此範例中,編譯模組210可將上述第一至第三模板結合上述第一至第三語法來產生語法表達式資料240。當電子裝置100執行自然語言理解操作時,處理器110可依據語法表達式資料240來取得多個語法規則。在此範例中,輸入裝置120提供的語料資料可例如是“請打開空調”、“請把空調打開”以及“請給我打開空調”。因此,處理器110可將語料“請打開空調”匹配於語法“<grammar_基本句式_1>”,並且輸出語意資訊 “openconditioner”。處理器110可將語料“請把空調打開”匹配於語法“<grammar_把字句_1>”,並且輸出語意資訊“openconditioner”。處理器110可將語料“請給我打開空調”匹配於語法“<grammar_幫忙_動賓結構_1>”,並且輸出語意資訊“openconditioner”。據此,使用者無需編譯任何語法規則即可依據本發明的語法編譯系統10來產生多個語法。並且,使用者可依據不同需求來決定詞組資料220的詞組內容以及詞組數量,而不限於上述範例。 Therefore, in this example, the compiling module 210 may combine the first to third templates with the first to third grammars to generate grammatical expression data 240. When the electronic device 100 performs a natural language understanding operation, the processor 110 may obtain a plurality of grammatical rules according to the grammatical expression data 240. In this example, the corpus data provided by the input device 120 may be, for example, “Please turn on the air conditioner”, “Please turn on the air conditioner”, and “Please turn on the air conditioner for me”. Therefore, the processor 110 may match the corpus "Please turn on the air conditioner" to the grammar "<grammar_basic sentence pattern 1>" and output semantic information "Openconditioner". The processor 110 may match the corpus "Please turn on the air conditioner" to the grammar "<grammar_ 把 字句 _1>" and output the semantic information "openconditioner". The processor 110 may match the corpus "Please turn on the air conditioner for me" to the grammar "<grammar_ 帮帮 _ 动 宾 结构 _1>" and output the semantic information "openconditioner". Accordingly, the user can generate a plurality of syntaxes according to the syntax compiling system 10 of the present invention without compiling any syntax rules. In addition, the user can determine the phrase content and the number of phrases of the phrase data 220 according to different needs, and is not limited to the above examples.

圖3繪示本發明的一實施例的語法編譯方法的流程圖。參考圖1至圖3,本實施例的語法編譯方法可至少適用於圖1以及圖2的語法編譯系統10。在步驟S310中,電子裝置100執行編譯模組210,並且讀取編譯模組210當中的內建句式模板211,其中內建句式模板211包括多個形式參數,並且編譯模組210為語法編譯平台。在步驟S320中,電子裝置100經由輸入裝置120接收詞組資料220以及語意資料230。編譯模組210將詞組資料220以及語意資料230與內建句式模板211結合,以產生語法表達式資料240,其中語法表達式資料240可用於產生多個語法。也就是說,本實施例的語法編譯方法可直接將使用者輸入的詞組資料220以及語意資料230與內建句式模板211結合,以快速地且便利地產生語法表達式資料240。因此,本實施例的語法編譯方法可有效節省編譯語法的工作量。 FIG. 3 is a flowchart of a syntax compiling method according to an embodiment of the present invention. Referring to FIG. 1 to FIG. 3, the syntax compiling method of this embodiment is applicable to at least the syntax compiling system 10 of FIGS. 1 and 2. In step S310, the electronic device 100 executes the compilation module 210, and reads a built-in sentence template 211 in the compiled module 210. The built-in sentence template 211 includes a plurality of formal parameters, and the compiled module 210 has syntax Compile platform. In step S320, the electronic device 100 receives the phrase data 220 and the semantic data 230 via the input device 120. The compilation module 210 combines the phrase data 220 and the semantic data 230 with the built-in sentence template 211 to generate grammatical expression data 240. The grammatical expression data 240 can be used to generate multiple grammars. That is, the grammar compiling method of this embodiment can directly combine the phrase data 220 and semantic data 230 input by the user with the built-in sentence template 211 to quickly and conveniently generate the grammatical expression data 240. Therefore, the syntax compiling method of this embodiment can effectively save the workload of compiling the syntax.

此外,關於本實施例的語法編譯系統10的相關裝置特徵以及技術內容可依據上述圖1以及圖2實施例的內容而獲致足夠 的教示、建議以及實施說明,因此不再贅述。 In addition, the relevant device features and technical contents of the syntax compiling system 10 of this embodiment can be obtained based on the contents of the embodiments of FIG. 1 and FIG. 2 described above. Instructions, recommendations, and implementation instructions, so I wo n’t repeat them.

綜上所述,本發明的語法編譯系統以及語法編譯方法可預先在外部伺服器的平台上的編譯模組中預先建置有內建句式模板。因此,當使用者透過電子裝置與外部伺服器進行通訊時,電子裝置可直接讀取內建句式模板,並且將使用者輸入的詞組資料以及語意資料與內建句式模板結合,以快速地產生語法表達式資料。此外,由於本發明的編譯模組以及內建句式模板建置在雲端系統中,因此雲端維護人員亦可直接更新或輸入新的內建句式模板至編譯模組,以讓多個使用者可分別透過各自的電子裝置來使用編譯模組中的內建句式模板。也就是說,本發明的語法編譯系統以及語法編譯方法可有效節省編譯語法的工作量,並且具有維護方便以及可即時更新的特性。 In summary, the grammar compiling system and the grammar compiling method of the present invention can pre-build a built-in sentence template in a compiling module on a platform of an external server. Therefore, when the user communicates with the external server through the electronic device, the electronic device can directly read the built-in sentence template, and combine the phrase data and semantic data entered by the user with the built-in sentence template to quickly Generate syntax expression data. In addition, since the compilation module and the built-in sentence template of the present invention are built in the cloud system, the cloud maintenance personnel can also directly update or enter a new built-in sentence template into the compilation module to allow multiple users The built-in sentence templates in the compilation module can be used through the respective electronic devices. That is, the syntax compiling system and the syntax compiling method of the present invention can effectively save the workload of compiling the syntax, and have the characteristics of convenient maintenance and instant update.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。 Although the present invention has been disclosed as above with the examples, it is not intended to limit the present invention. Any person with ordinary knowledge in the technical field can make some modifications and retouching without departing from the spirit and scope of the present invention. The protection scope of the present invention shall be determined by the scope of the attached patent application.

Claims (14)

一種語法編譯系統,適用於一自然語言,包括: 一編譯模組,具有一內建句式模板,該內建句式模板包括多個形式參數,其中該編譯模組為一語法編譯平台; 一輸入裝置,用以接收一詞組資料以及一語意資料;以及 一處理器,耦接該輸入裝置,並且用以執行該編譯模組, 其中當該處理器執行該編譯模組時,該處理器讀取該編譯模組當中的該內建句式模板,並且將該詞組資料以及該語意資料與該內建句式模板結合,以產生一語法表達式資料。A grammar compilation system suitable for a natural language includes: a compilation module having a built-in sentence template, the built-in sentence template includes multiple formal parameters, wherein the compilation module is a syntax compilation platform; a An input device for receiving phrase data and semantic data; and a processor coupled to the input device and for executing the compilation module, wherein when the processor executes the compilation module, the processor reads Take the built-in sentence template in the compilation module, and combine the phrase data and the semantic data with the built-in sentence template to generate a grammatical expression data. 如申請專利範圍第1項所述的語法編譯系統,其中當該處理器執行一自然語言理解操作時,該處理器接收該輸入裝置提供的一語料資料,其中該處理器藉由該語法表達式資料來產生多個語法規則資料,並且藉由該些語法規則資料來比對該語料資料,以取得對應於該語料資料的一語意資訊。The grammar compiling system according to item 1 of the scope of patent application, wherein when the processor performs a natural language understanding operation, the processor receives a corpus data provided by the input device, and the processor expresses by the grammar To generate multiple grammatical rule data, and compare the corpus data with the grammatical rule data to obtain semantic information corresponding to the corpus data. 如申請專利範圍第1項所述的語法編譯系統,其中該內建句式模板為一命令句式模板或一控制句式模板。The grammar compiling system according to item 1 of the patent application scope, wherein the built-in sentence template is a command sentence template or a control sentence template. 如申請專利範圍第1項所述的語法編譯系統,其中該些形式參數包括一動詞性短語參數以及一名詞性短語參數。The grammar compiling system according to item 1 of the scope of patent application, wherein the formal parameters include a verbal phrase parameter and a noun phrase parameter. 如申請專利範圍第1項所述的語法編譯系統,其中該詞組資料包括一動詞詞組資料以及一名詞詞組資料,並且該動詞詞組資料包括多個動詞實際參數,該名詞詞組資料包括多個名詞實際參數, 其中當該處理器將該詞組資料以及該語意資料與該內建句式模板組合,以產生該語法表達式資料時,該處理器將該些動詞實際參數的至少其中之一以及該些名詞實際參數的至少其中之一關聯於該些形式參數。The grammar compiling system according to item 1 of the patent application scope, wherein the phrase data includes a verb phrase data and a noun phrase data, and the verb phrase data includes a plurality of verb actual parameters, and the noun phrase data includes a plurality of noun actual Parameters, wherein when the processor combines the phrase data and the semantic data with the built-in sentence template to generate the grammatical expression data, the processor adds at least one of the actual parameters of the verbs and the At least one of the noun actual parameters is associated with the formal parameters. 如申請專利範圍第1項所述的語法編譯系統,其中該語意資料包括一字符串資料,並且該字符串資料包括一修飾符號以及一語意詞彙。The grammar compiling system according to item 1 of the scope of patent application, wherein the semantic data includes a character string data, and the character string data includes a modifier symbol and a semantic vocabulary. 如申請專利範圍第1項所述的語法編譯系統,更包括一外部伺服器,其中該編譯模組建置在該外部伺服器中,並且該處理器通訊連接至該外部伺服器,以讀取並執行該編譯模組。The syntax compiling system according to item 1 of the patent application scope further includes an external server, wherein the compiling module is built in the external server, and the processor is communicatively connected to the external server to read And execute the compilation module. 一種語法編譯方法,適用於一自然語言,包括: 執行一編譯模組,並且讀取該編譯模組當中的一內建句式模板,其中該內建句式模板包括多個形式參數,並且該編譯模組為一語法編譯平台; 接收一詞組資料以及一語意資料;以及 將該詞組資料以及該語意資料與該內建句式模板結合,以產生一語法表達式資料。A syntax compilation method applicable to a natural language includes: executing a compilation module and reading a built-in sentence template in the compiled module, wherein the built-in sentence template includes a plurality of formal parameters, and the The compiling module is a grammar compiling platform; receiving a phrase data and a semantic data; and combining the phrase data and the semantic data with the built-in sentence template to generate a grammatical expression data. 如申請專利範圍第8項所述的語法編譯方法,更包括: 執行一自然語言理解操作,並且該自然語言理解操作包括: 接收一語料資料; 藉由該語法表達式資料來產生多個語法規則資料;以及 藉由該些語法規則資料來比對該語料資料,以取得對應於該語料資料的一語意資訊。The grammar compiling method described in item 8 of the patent application scope further includes: performing a natural language comprehension operation, and the natural language comprehension operation includes: receiving a corpus data; generating a plurality of grammars by using the grammar expression data Rule data; and comparing the corpus data with the grammatical rule data to obtain semantic information corresponding to the corpus data. 如申請專利範圍第8項所述的語法編譯方法,其中該內建句式模板為一命令句式模板或一控制句式模板。The grammar compiling method according to item 8 of the scope of the patent application, wherein the built-in sentence template is a command sentence template or a control sentence template. 如申請專利範圍第8項所述的語法編譯方法,其中該些形式參數包括一動詞性短語參數以及一名詞性短語參數。The grammar compiling method according to item 8 of the scope of the patent application, wherein the formal parameters include a verbal phrase parameter and a noun phrase parameter. 如申請專利範圍第8項所述的語法編譯方法,其中該詞組資料包括一動詞詞組資料以及一名詞詞組資料,並且該動詞詞組資料包括多個動詞實際參數,該名詞詞組資料包括多個名詞實際參數,其中將該詞組資料以及該語意資料與該內建句式模板組合,以產生該語法表達式資料的步驟包括: 將該些動詞實際參數的至少其中之一以及該些名詞實際參數的至少其中之一關聯於該些形式參數。The grammar compiling method according to item 8 of the scope of patent application, wherein the phrase data includes a verb phrase data and a noun phrase data, and the verb phrase data includes a plurality of verb actual parameters, and the noun phrase data includes a plurality of noun actuals Parameters, wherein the combination of the phrase data and the semantic data with the built-in sentence template to generate the grammatical expression data includes: at least one of the actual parameters of the verbs and at least one of the actual parameters of the nouns One of them is associated with the formal parameters. 如申請專利範圍第8項所述的語法編譯方法,其中該語意資料包括一字符串資料,並且該字符串資料包括一修飾符號以及一語意詞彙。The grammar compiling method according to item 8 of the scope of patent application, wherein the semantic data includes a character string data, and the character string data includes a modifier symbol and a semantic vocabulary. 如申請專利範圍第8項所述的語法編譯方法,其中該編譯模組建置在一外部伺服器中,並且執行該編譯模組的步驟包括: 通訊連接至該外部伺服器,以讀取並執行該編譯模組。The syntax compiling method according to item 8 of the scope of patent application, wherein the compiling module is built in an external server, and the steps of executing the compiling module include: communicating with the external server to read and compile Execute the compilation module.
TW107111464A 2018-02-06 2018-03-31 Grammar compiling system and grammar compiling method TWI675365B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
??201810116657.2 2018-02-06
CN201810116657.2A CN108228191B (en) 2018-02-06 2018-02-06 Grammar compiling system and grammar compiling method

Publications (2)

Publication Number Publication Date
TW201935462A TW201935462A (en) 2019-09-01
TWI675365B true TWI675365B (en) 2019-10-21

Family

ID=62669621

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107111464A TWI675365B (en) 2018-02-06 2018-03-31 Grammar compiling system and grammar compiling method

Country Status (2)

Country Link
CN (1) CN108228191B (en)
TW (1) TWI675365B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201626363A (en) * 2015-01-12 2016-07-16 芋頭科技(杭州)有限公司 A voice recognition system of a robot system and method thereof
TW201629949A (en) * 2014-09-30 2016-08-16 蘋果公司 A caching apparatus for serving phonetic pronunciations
CN107610693A (en) * 2016-07-11 2018-01-19 科大讯飞股份有限公司 The construction method and device of text corpus
CN107644642A (en) * 2017-09-20 2018-01-30 广东欧珀移动通信有限公司 Method for recognizing semantics, device, storage medium and electronic equipment
US20180032610A1 (en) * 2016-07-29 2018-02-01 Paul Charles Cameron Systems and methods for automatic-creation of soundtracks for speech audio
US20180033435A1 (en) * 2014-09-15 2018-02-01 Desprez, Llc Natural language user interface for computer-aided design systems
US20180033432A1 (en) * 2016-08-01 2018-02-01 Toyota Jidosha Kabushiki Kaisha Voice interactive device and voice interaction method
JP2018018053A (en) * 2016-07-13 2018-02-01 株式会社富士通ソーシアルサイエンスラボラトリ Terminal device, translation method, and translation program
CN107660303A (en) * 2015-06-26 2018-02-02 英特尔公司 The language model of local speech recognition system is changed using remote source

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7890328B1 (en) * 2006-09-07 2011-02-15 At&T Intellectual Property Ii, L.P. Enhanced accuracy for speech recognition grammars
KR101042515B1 (en) * 2008-12-11 2011-06-17 주식회사 네오패드 Method for searching information based on user's intention and method for providing information
CN102479508B (en) * 2010-11-30 2015-02-11 国际商业机器公司 Method and system for converting text to voice
ES2409530B1 (en) * 2011-10-14 2014-05-14 Telefónica, S.A. METHOD FOR MANAGING THE RECOGNITION OF THE AUDIO CALL SPEAK
CN103294666B (en) * 2013-05-28 2017-03-01 百度在线网络技术(北京)有限公司 Grammar compilation method, semantic analytic method and corresponding intrument
CN103440234B (en) * 2013-07-25 2017-03-01 清华大学 Natural language understanding system and method
CN106372054B (en) * 2015-07-24 2020-10-09 中兴通讯股份有限公司 Method and device for multi-language semantic analysis
CN106649253B (en) * 2015-11-02 2019-03-22 涂悦 Auxiliary control method and system based on rear verifying
CN105895090A (en) * 2016-03-30 2016-08-24 乐视控股(北京)有限公司 Voice signal processing method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180033435A1 (en) * 2014-09-15 2018-02-01 Desprez, Llc Natural language user interface for computer-aided design systems
TW201629949A (en) * 2014-09-30 2016-08-16 蘋果公司 A caching apparatus for serving phonetic pronunciations
TW201626363A (en) * 2015-01-12 2016-07-16 芋頭科技(杭州)有限公司 A voice recognition system of a robot system and method thereof
CN107660303A (en) * 2015-06-26 2018-02-02 英特尔公司 The language model of local speech recognition system is changed using remote source
CN107610693A (en) * 2016-07-11 2018-01-19 科大讯飞股份有限公司 The construction method and device of text corpus
JP2018018053A (en) * 2016-07-13 2018-02-01 株式会社富士通ソーシアルサイエンスラボラトリ Terminal device, translation method, and translation program
US20180032610A1 (en) * 2016-07-29 2018-02-01 Paul Charles Cameron Systems and methods for automatic-creation of soundtracks for speech audio
US20180033432A1 (en) * 2016-08-01 2018-02-01 Toyota Jidosha Kabushiki Kaisha Voice interactive device and voice interaction method
CN107644642A (en) * 2017-09-20 2018-01-30 广东欧珀移动通信有限公司 Method for recognizing semantics, device, storage medium and electronic equipment

Also Published As

Publication number Publication date
TW201935462A (en) 2019-09-01
CN108228191A (en) 2018-06-29
CN108228191B (en) 2022-01-25

Similar Documents

Publication Publication Date Title
US8117022B2 (en) Method and system for machine understanding, knowledge, and conversation
JP6493866B2 (en) Information processing apparatus, information processing method, and program
US9805718B2 (en) Clarifying natural language input using targeted questions
US8719006B2 (en) Combined statistical and rule-based part-of-speech tagging for text-to-speech synthesis
KR20090069275A (en) Method, used by computers, for developing an ontology from a text in natural language
CN110782880B (en) Training method and device for prosody generation model
Jakupović et al. Formalisation method for the text expressed knowledge
TWI652668B (en) Natural language recognition device and natural language recognition method
TWI675365B (en) Grammar compiling system and grammar compiling method
KR102629063B1 (en) Question answering system by using constraints and information provision method thereof
Rawoof et al. ARM based implementation of Text-To-Speech (TTS) for real time Embedded System
CN113191140B (en) Text processing method and device, electronic equipment and storage medium
CN108021559B (en) Natural language understanding system and semantic analysis method
CN111258566A (en) Method and system for extracting logic flow generation code from natural language
Jolly et al. Anatomizing lexicon with natural language Tokenizer Toolkit 3
Zare et al. Deepnorm-a deep learning approach to text normalization
US20170010778A1 (en) Action design apparatus and computer readable medium
Ekpenyong et al. Agent-based framework for intelligent natural language interface
JP2004271615A (en) Information processor
Fahad et al. An Approach towards Implementation of Active and Passive voice using LL (1) Parsing
Ranta Grammatical Framework: an Interlingual Grammar Formalism.
Rohatgi et al. DeepNorm-A Deep learning approach to Text Normalization
Kozerenko Functional and cognitive aspects in linguistic modelling
Gordon et al. English for spoken programming
Rahman et al. Parsing of part-of-speech tagged Assamese Texts