Method and device for generating linear time sequence logic protocol of smart home

文档序号:1544936 发布日期:2020-01-17 浏览:27次 中文

阅读说明:本技术 一种智能家居线性时序逻辑规约生成的方法和装置 (Method and device for generating linear time sequence logic protocol of smart home ) 是由 卜磊 翟娟 张时雨 张秋萍 赵建华 李宣东 于 2019-09-29 设计创作,主要内容包括:本发明公开了一种由智能家居生成线性时序逻辑规约的方法和装置,用于在智能家居领域中将用户输入的自然语言需求文本转换成线性时序逻辑规约。该方法首先对输入的自然语言文本进行预处理;然后使用自然语言处理技术,生成语法分析树和语法依存关系;识别句子中的各个子句,以及每个子句中的主语、谓语、宾语、布尔运算符、条件变量和时序运算符,生成树形的中间表示形式;最后遍历树结构,自动生成对应的线性时序逻辑规约。本发明解决了普通智能家居用户难以直接提供形式化规约的问题,有效节约时间和人力成本,并且能够弥补现有智能家居物联网验证系统的不足,使得不具备专业知识的普通用户所提出的自然语言需求能够被自动的验证。(The invention discloses a method and a device for generating a linear time sequence logic protocol by an intelligent home, which are used for converting a natural language requirement text input by a user into the linear time sequence logic protocol in the field of the intelligent home. Firstly, preprocessing an input natural language text; then, generating a syntax analysis tree and a syntax dependency relationship by using a natural language processing technology; identifying each clause in the sentence, and subject, predicate, object, Boolean operator, condition variable and time sequence operator in each clause to generate an intermediate representation form of a tree; and finally traversing the tree structure and automatically generating a corresponding linear time sequence logic protocol. The invention solves the problem that common intelligent household users are difficult to directly provide formal conventions, effectively saves time and labor cost, and can make up the defects of the existing intelligent household Internet of things verification system, so that natural language requirements provided by common users without professional knowledge can be automatically verified.)

1. a method for generating a linear time sequence logic protocol of an intelligent home is characterized by comprising the following steps:

s1: acquiring a domain knowledge vocabulary, a semantic translation template, a protocol translation template, intelligent household equipment description information in a current scene and a natural language requirement text input by a user; the domain knowledge vocabulary is a comparison table of system terms and natural language; the semantic translation template defines the translation contrast from a natural semantic logic clause to a logic operation clause; the protocol translation template defines the translation contrast from a natural semantic logic clause to a time sequence operation clause;

s2: converting the natural language in the natural language requirement text into system terms according to the domain knowledge vocabulary;

s3: analyzing the natural language requirement text obtained in the step S2 by using a natural language processing technology to generate a syntactic analysis tree;

s4: recognizing each clause in the syntax analysis tree obtained in the step S3 by using a semantic analysis technology, and generating a natural semantic logic clause tree by combining a subject, a predicate, an object, a Boolean operator, a condition variable and a time sequence operator in each clause;

s5: translating the natural semantic logic clauses in the natural semantic logic clause tree and the relation between the natural semantic logic clauses into linear time sequence logic conventions according to the semantic translation template and the convention translation template;

the step S4 includes the steps of:

s41: through the recognition of noun phrases and verb phrases in sentence nodes and clause nodes of the syntactic analysis tree, dividing subtrees corresponding to the corresponding sentence nodes and clause nodes into syntactic clause trees;

s42: extracting a subject, a predicate and an object from the syntax clause tree;

s43: extracting Boolean operators, condition variables and time sequence operators from the syntax clause tree through keyword matching;

s44: and according to the syntactic analysis tree, composing the subject, predicate, object, Boolean operator, condition variable and time sequence operator extracted from each syntactic clause tree into a natural semantic logic clause tree.

2. The method for generating linear time series logic conventions for smart homes according to claim 1, wherein the step S3 further comprises:

s31: when the natural language requirement text is analyzed by using a natural language processing technology to generate the syntactic analysis tree, generating a syntactic dependency relationship;

s32: and adjusting the syntax analysis tree through ambiguity analysis of the syntax dependency relationship.

3. The method for generating linear time-series logic conventions for smart homes according to claim 1, wherein the step S5 comprises:

s51: converting a subject, a predicate and an object in a natural semantic logic clause in the natural semantic logic clause tree into an atomic proposition according to the semantic translation template;

s52: traversing the tree structure of the natural semantic logic clause tree, translating Boolean operators, condition variables and time sequence operators according to the specification translation template, and combining all the atomic propositions into a complete linear time sequence logic specification.

4. The utility model provides a device that linear sequential logic stipulations of intelligence house generated which characterized in that includes following module:

m1, used for: acquiring a domain knowledge vocabulary, a semantic translation template, a protocol translation template, intelligent household equipment description information in a current scene and a natural language requirement text input by a user; the domain knowledge vocabulary is a comparison table of system terms and natural language; the semantic translation template defines the translation contrast from a natural semantic logic clause to a logic operation clause; the protocol translation template defines the translation contrast from a natural semantic logic clause to a time sequence operation clause;

m2, used for: converting the natural language in the natural language requirement text into system terms according to the domain knowledge vocabulary;

m3, used for: analyzing the natural language requirement text obtained by the module M2 by using a natural language processing technology to generate a syntactic analysis tree;

m4, used for: using a semantic analysis technology to identify each clause in the syntax analysis tree obtained by the module M3, and combining a subject, a predicate, an object, a Boolean operator, a condition variable and a time sequence operator in each clause to generate a natural semantic logic clause tree;

m5, used for: translating the natural semantic logic clauses in the natural semantic logic clause tree and the relation between the natural semantic logic clauses into linear time sequence logic conventions according to the semantic translation template and the convention translation template;

the module M4 comprises the following steps:

m41, used for: through the recognition of noun phrases and verb phrases in sentence nodes and clause nodes of the syntactic analysis tree, dividing subtrees corresponding to the corresponding sentence nodes and clause nodes into syntactic clause trees;

m42, used for: extracting a subject, a predicate and an object from the syntax clause tree;

m43, used for: extracting Boolean operators, condition variables and time sequence operators from the syntax clause tree through keyword matching;

m44, used for: and according to the syntactic analysis tree, composing the subject, predicate, object, Boolean operator, condition variable and time sequence operator extracted from each syntactic clause tree into a natural semantic logic clause tree.

5. The apparatus for generating linear sequential logic conventions for smart homes according to claim 4, wherein the module M3 further comprises:

m31, used for: when the natural language requirement text is analyzed by using a natural language processing technology to generate the syntactic analysis tree, generating a syntactic dependency relationship;

m32, used for: and adjusting the syntax analysis tree through ambiguity analysis of the syntax dependency relationship.

6. The apparatus for generating linear sequential logic conventions for smart homes according to claim 4, wherein the module M5 comprises:

m51, used for: converting a subject, a predicate and an object in a natural semantic logic clause in the natural semantic logic clause tree into an atomic proposition according to the semantic translation template;

m52, used for: traversing the tree structure of the natural semantic logic clause tree, translating Boolean operators, condition variables and time sequence operators according to the specification translation template, and combining all the atomic propositions into a complete linear time sequence logic specification.

Technical Field

The invention relates to automatic generation of a linear time sequence logic protocol in the field of intelligent home furnishing.

Background

Rapidly developing and popularizing smart home technologies and devices are changing lives of people, and a plurality of IoT platforms (such as IFTTT, Apple HomeKit and the like) provide services for constructing home automation for common smart home users, connect various smart home devices by compiling rules and meet complex requirements of the users. The technology brings convenience and introduces some potential safety hazards. A great variety of intelligent devices are connected together through complex user-defined rules, so that the behavior of the system is difficult to predict, and a user cannot know whether the user-defined intelligent home system can correctly meet the own requirements when in operation. Some incorrect rules or uncertain chain reactions may even cause safety accidents, so it is necessary to verify the user-defined smart home system.

It is an emerging trend to use formal methods, particularly model checking techniques, to simulate and verify the correctness of user-defined smart home systems. Existing research is primarily concerned with modeling and validating system behavior, but the input to model verification, i.e., the generation of formalization conventions, is of less concern.

The mastering of formal conventions requires a lot of learning and training, and writing formal conventions is almost impossible for ordinary users, which causes a problem that the ordinary users want to verify their own needs.

Disclosure of Invention

The problems to be solved by the invention are as follows: the method and the device for converting the natural language requirements of the user into the linear time sequence logic protocols in the field of smart home are provided, so that an ordinary user does not need to learn the formal protocols professionally, and only needs to provide texts defined by the natural language requirements.

In order to solve the problems, the invention adopts the following scheme:

the method for generating the linear time sequence logic protocol of the smart home comprises the following steps:

s1: acquiring a domain knowledge vocabulary, a semantic translation template, a protocol translation template, intelligent household equipment description information in a current scene and a natural language requirement text input by a user; the domain knowledge vocabulary is a comparison table of system terms and natural language; the semantic translation template defines the translation contrast from a natural semantic logic clause to a logic operation clause; the protocol translation template defines the translation contrast from a natural semantic logic clause to a time sequence operation clause;

s2: converting the natural language in the natural language requirement text into system terms according to the domain knowledge vocabulary;

s3: analyzing the natural language requirement text obtained in the step S2 by using a natural language processing technology to generate a syntactic analysis tree;

s4: recognizing each clause in the syntax analysis tree obtained in the step S3 by using a semantic analysis technology, and generating a natural semantic logic clause tree by combining a subject, a predicate, an object, a Boolean operator, a condition variable and a time sequence operator in each clause;

s5: translating the natural semantic logic clauses in the natural semantic logic clause tree and the relation between the natural semantic logic clauses into linear time sequence logic conventions according to the semantic translation template and the convention translation template;

the step S4 includes the steps of:

s41: through the recognition of noun phrases and verb phrases in sentence nodes and clause nodes of the syntactic analysis tree, dividing subtrees corresponding to the corresponding sentence nodes and clause nodes into syntactic clause trees;

s42: extracting a subject, a predicate and an object from the syntax clause tree;

s43: extracting Boolean operators, condition variables and time sequence operators from the syntax clause tree through keyword matching;

s44: and according to the syntactic analysis tree, composing the subject, predicate, object, Boolean operator, condition variable and time sequence operator extracted from each syntactic clause tree into a natural semantic logic clause tree.

Further, according to the method for generating a linear time sequence logic specification of a smart home, in the step S3, the method further includes:

s31: when the natural language requirement text is analyzed by using a natural language processing technology to generate the syntactic analysis tree, generating a syntactic dependency relationship;

s32: and adjusting the syntax analysis tree through ambiguity analysis of the syntax dependency relationship.

Further, according to the method for generating a linear time sequence logic specification of a smart home, the step S5 includes:

s51: converting a subject, a predicate and an object in a natural semantic logic clause in the natural semantic logic clause tree into an atomic proposition according to the semantic translation template;

s52: traversing the tree structure of the natural semantic logic clause tree, translating Boolean operators, condition variables and time sequence operators according to the specification translation template, and combining all the atomic propositions into a complete linear time sequence logic specification.

The device for generating the linear time sequence logic protocol of the smart home comprises the following modules:

m1, used for: acquiring a domain knowledge vocabulary, a semantic translation template, a protocol translation template, intelligent household equipment description information in a current scene and a natural language requirement text input by a user; the domain knowledge vocabulary is a comparison table of system terms and natural language; the semantic translation template defines the translation contrast from a natural semantic logic clause to a logic operation clause; the protocol translation template defines the translation contrast from a natural semantic logic clause to a time sequence operation clause;

m2, used for: converting the natural language in the natural language requirement text into system terms according to the domain knowledge vocabulary;

m3, used for: analyzing the natural language requirement text obtained by the module M2 by using a natural language processing technology to generate a syntactic analysis tree;

m4, used for: using a semantic analysis technology to identify each clause in the syntax analysis tree obtained by the module M3, and combining a subject, a predicate, an object, a Boolean operator, a condition variable and a time sequence operator in each clause to generate a natural semantic logic clause tree;

m5, used for: translating the natural semantic logic clauses in the natural semantic logic clause tree and the relation between the natural semantic logic clauses into linear time sequence logic conventions according to the semantic translation template and the convention translation template;

the module M4 comprises the following steps:

m41, used for: through the recognition of noun phrases and verb phrases in sentence nodes and clause nodes of the syntactic analysis tree, dividing subtrees corresponding to the corresponding sentence nodes and clause nodes into syntactic clause trees;

m42, used for: extracting a subject, a predicate and an object from the syntax clause tree;

m43, used for: extracting Boolean operators, condition variables and time sequence operators from the syntax clause tree through keyword matching;

m44, used for: and according to the syntactic analysis tree, composing the subject, predicate, object, Boolean operator, condition variable and time sequence operator extracted from each syntactic clause tree into a natural semantic logic clause tree.

Further, according to the apparatus for generating a linear timing logic specification of a smart home according to the present invention, the module M3 further includes:

m31, used for: when the natural language requirement text is analyzed by using a natural language processing technology to generate the syntactic analysis tree, generating a syntactic dependency relationship;

m32, used for: and adjusting the syntax analysis tree through ambiguity analysis of the syntax dependency relationship.

Further, according to the apparatus for generating a linear time sequence logic specification of a smart home according to the present invention, the module M5 includes:

m51, used for: converting a subject, a predicate and an object in a natural semantic logic clause in the natural semantic logic clause tree into an atomic proposition according to the semantic translation template;

m52, used for: traversing the tree structure of the natural semantic logic clause tree, translating Boolean operators, condition variables and time sequence operators according to the specification translation template, and combining all the atomic propositions into a complete linear time sequence logic specification.

The invention has the following technical effects:

1. the invention provides a method for converting the natural language requirements of a user into a generated linear time sequence logic protocol, so that a common user does not need to learn a formal protocol professionally, only needs to provide a text defined by the natural language requirements, and can also realize the correctness verification of a user-defined intelligent home system.

2. The conversion method of the invention fully considers the ambiguity of natural language and corrects the attaching ambiguity and conjunctive ambiguity caused by the ambiguity in English.

Drawings

FIG. 1 is a flow chart of a method of an embodiment of the present invention.

FIG. 2 is an example of a parse tree requiring an output of an open source toolkit according to an embodiment of the present invention.

FIG. 3 is an example parse tree for an example requirement two open source toolkit output according to an embodiment of the present invention.

FIG. 4 is an example of syntactic dependencies that illustrate the output of the requirement two open source toolkit according to an embodiment of the present invention.

FIG. 5 is an example of the parse tree of FIG. 3 adjusted by the syntax dependency ambiguity analysis of FIG. 4.

FIG. 6 is an example parse tree illustrating the output of the requirement three-way open source toolkit according to an embodiment of the present invention.

FIG. 7 is a diagram illustrating an example of syntactic dependencies requiring the output of a three-channel open source toolkit according to an embodiment of the present invention.

FIG. 8 is an example of the parse tree of FIG. 6 adjusted by the syntax dependency ambiguity analysis of FIG. 7.

Fig. 9 is an example of the parse tree of fig. 2 converted into a natural semantic logical clause tree.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings.

The invention discloses a method for generating a linear time sequence logic protocol of an intelligent home, which comprises the following five steps:

s1: acquiring data;

s2: the term replacement;

s3: generating a syntax analysis tree;

s4: converting the syntax analysis tree into a natural semantic logic clause tree;

s5: and traversing the natural semantic logic clause tree to generate a linear time sequence logic specification.

In step S1, the data in the step of acquiring data is composed of five parts, which are a domain knowledge vocabulary, a semantic translation template, a specification translation template, smart home device description information, and a natural language requirement text. Wherein, the domain knowledge vocabulary, the semantic translation template and the protocol translation template are preset by the method; the intelligent household equipment description information is the intelligent household equipment description information in the current application scene and is generally obtained by automatic provision of the intelligent household equipment through network connection; the natural language requirement text is edited and input by the user. Therefore, the actual input of the method of the present invention is only the natural language requirement text input by the user. The description information of the intelligent home equipment is defined by the intelligent home equipment of various different manufacturers, can be automatically provided and obtained by the intelligent home equipment, and can also be obtained by manual editing. The description information of the intelligent household equipment comprises basic information definition of the equipment, accessible data definition of the equipment and executable action of the equipment. Device basic information includes, but is not limited to, name, type, serial number, location, etc.

The domain knowledge vocabulary is a comparison of system terms to natural language. The system terminology herein falls into two categories: the first category is terminology related to smart home devices; the second category is the term associated with linear sequential logic conventions. The terminology related to the smart home device is divided into noun terminology and verb terminology. The term, such as GAS _ condensation, refers to GAS CONCENTRATION, and natural language includes GAS CONCENTRATION, GAS level, GAS density, etc. Verb terms, such as Turnon, denote device on actions, which in contrast to natural language include turn on, switch on, activate, open, and the like. Terms related to linear sequential logic conventions are generally adverbs, such as the sequential operator F in linear sequential logic conventions, against natural languages including eventualy, finaly, etc.

The semantic translation template defines the translation contrast from a natural semantic logic clause to a logic operation clause. The protocol translation template defines the translation contrast from the natural semantic logic clause to the time sequence operation clause. As is well known, a linear sequential logic convention consists of atomic propositions and operations between them. The syntax of the linear sequential logic specification can be expressed as:

Figure BDA0002221588260000051

wherein p is an atomic proposition;a V and B are logic operators, G, X, F, U and → are time sequence operators. The semantic translation template is compared with the logic operation of the atomic propositions in the linear time sequence logic specification, and the specification translation template is compared with the time sequence operation between the atomic propositions in the linear time sequence logic specification. For example, the following is an example of a semantic translation template:

natural semantic logical clauses Translated logical operation clause
subj be_GreaterThan obj subj>obj
subj be_LessThan obj subj<obj
subj be_TurnOn subj_state=ON
subj be_TurnOff subj_state=OFF

The following are examples of protocol translation templates:

natural semantic logical clauses Translated sequential operation clause
φ1untilφ2 φ12
φ1beforeφ2 2→(φ12)
φ1afterφ2 G(φ2→Gφ1)

The natural language requirement text is edited and input by the user. The following text is an example of a natural language requirement text:

REQ1:When the gas concentration exceeds 10%,the alarm should beactivated immediately until the gas concentration is below 8%.

REQ2:When the camera gets a new photo,a message should be sent to themobile phone with the photo.

REQ3:The AC cooler in the bedroom and the AC heater in the livingroom shouldn’tbe on simultaneously.

in the above example of natural language requirement text, the user defines three requirements: demand one, when the gas concentration exceeds 10%, the alarm must be turned on immediately until the gas concentration is lower than 8%; secondly, when a camera takes a new photo, information with the photo needs to be sent to the mobile phone; and thirdly, the air-conditioning refrigerator in the bedroom and the air-conditioning heater in the living room cannot be started simultaneously.

The above example of the natural language requirement text is converted into a linear time sequence logic specification by a manual conversion method as follows:

G(GAS_CONCENTRATION>10→X(ALARM_state=ON U GAS_CONCENTRATION<8))

G(CAMERA.NewPhoto=TRUE→MOBILE_PHONE.SendMsg=TRUE)

Figure BDA0002221588260000061

the invention aims to convert the natural language requirement text input by the user into the linear time sequence logic protocol in the form.

Step S2 term replacement refers to converting the natural language in the natural language requirement text into system terms according to the domain knowledge vocabulary. Therefore, the input of step S2 is the preset domain knowledge vocabulary and the natural language requirement text input by the user, and the output is the natural language requirement text after term replacement. Specifically, a corresponding natural language in the domain knowledge vocabulary is found in the natural language requirement text, and then the natural language is replaced by a corresponding system term, for example, if the system term corresponding to the GAS CONCENTRATION in the domain knowledge vocabulary in requirement one is GAS _ CONCENTRATION, all the GAS CONCENTRATION character strings in the natural language requirement text are replaced by the system term GAS _ CONCENTRATION. The natural language requirement text of the aforementioned three requirements is replaced by terms as follows:

REQ1:When the GAS_CONCENTRATION exceeds 10%,the ALARM should beactivated immediately until the GAS_CONCENTRATION is below 8%.

REQ2:When the CAMERA gets a new photo,a MESSAGE should be sent to theMOBILE_PHONE with the PHOTO.

REQ3:The AC_COOLER in the BEDROOM and the AC_HEATER in the LIVINGROOMshouldn’t be on simultaneously.

the purpose of the term substitution in step S2 is to facilitate the use of subsequent natural language processing tools, resulting in more accurate parsing results.

The input of step S3 is the natural language requirement text after term replacement in step S2, and the output is a parse tree, specifically, the natural language requirement text obtained in step S2 is analyzed by using a natural language processing technique to generate a parse tree. Natural Language processing techniques, i.e., nlp (natural Language processing), are familiar to those skilled in the art. In this embodiment, an open source toolkit Stanford Parser is used to perform part-of-speech tagging and syntax analysis on a sentence, so as to obtain a syntax analysis tree. FIG. 2 is a diagram of a parse tree obtained by analyzing a requirement in the natural language requirement text of the three requirements through natural language processing technology. In fig. 2, ROOT represents a ROOT node of an entire sentence; IN the non-leaf nodes, S represents a sentence, SBAR represents a clause, NP represents a noun phrase, VP represents a verb phrase, WHADVP represents a Wh adverb phrase, DT represents a qualifier, NN represents a noun, VB represents a verb, VBZ represents a verb third person, VBN represents a verb past participle of the verb, CD represents a number, MD represents a modal verb, RB represents an adverb, IN represents a preposition, and PP represents a preposition phrase; the leaf node is the sentence content.

Ambiguity is one of the characteristics of natural language, which is an inevitable problem for most natural language processing efforts. Ambiguity can lead to errors in the results of the parsing and thus to the generation of erroneous LTLs. It is difficult to quickly locate ambiguities by directly parsing the parse tree. For this reason, in the present embodiment, the parse tree obtained after parsing by the natural language processing technique is simultaneously parsed by the natural language processing technique to obtain the syntactic dependency, and then the parse tree is adjusted by the ambiguity analysis of the syntactic dependency. That is, in this embodiment, after the open source toolkit Stanford Parser is used to perform part-of-speech tagging and parsing on the sentence, the open source toolkit Stanford Parser outputs a parsing tree and a syntax dependency relationship, and then the parsing tree is adjusted according to ambiguity analysis of the syntax dependency relationship, and finally the output of step S3 is the parsing tree after ambiguity analysis adjustment. Common english structural ambiguities are attaching ambiguities and conjunctive ambiguities. The ambiguity analysis of the grammar dependency relationship in this embodiment processes the following two ambiguities respectively:

attaching ambiguity: attachment ambiguity refers to the fact that a particular component in a sentence can be attached at multiple locations on the syntax tree. Taking the aforementioned requirement two as an example, fig. 3 is a parsing tree output by the open source toolkit Stanford Parser, and fig. 4 is a syntax dependency relationship output by the open source toolkit Stanford Parser. As can be readily seen by human processing, the dotted preposed phrase with the PHOTO in FIG. 3 is a definition of MESSAGE. As can be seen from the dashed-line labeled syntactic dependencies of FIG. 4, the parsing associates PHOTO and MOBILE _ PHONE together. In the definition of the smart device description information, there is no direct relationship between PHOTO and MOBILE _ PHONE, and PHOTO belongs to a MESSAGE, and there is a direct relationship between them. Therefore, by means of the intelligent device description information, after errors are detected from the grammar dependency relationship, the MESSAGE node is found, and the preposed phrase with the PHOTO in the grammar tree is moved to the correct position. FIG. 5 is an adjusted parse tree for ambiguity analysis.

Word connection ambiguity: conjunctive ambiguity refers to the multiple understandings resulting from different structural relationships in the parallel structures connected by the conjunctions. Taking the aforementioned requirement three as an example, fig. 6 is a parsing tree output by the open source toolkit Stanford Parser, and fig. 7 is a syntax dependency relationship output by the open source toolkit Stanford Parser. As can be readily seen by the human process, the terms AC _ COOLER in the BEDROOM and AC _ HEATOR in the LIVINGROOM are two juxtaposed noun phrases, and the terms BEDROOM and AC _ HEATOR in the LIVINGROOM are juxtaposed from the parse tree labeled in FIG. 6 and the grammar dependency labeled in FIG. 7. In the definition of the smart Device description information, the type of bediron is "Location", and the type of AC _ provider is "Device", and the two types cannot be collocated in a subject and share a predicate. Thus, the nearest noun of type match, i.e., AC _ COOLER, is found, thus shifting the conjunction and its nodes to the right up. FIG. 8 is an ambiguity analysis adjusted parse tree.

In order to obtain the semantic and time series information required for generating the linear time series logic convention from the syntax tree, in step S4, each clause in the syntax analysis tree obtained in step S3 is identified by using a semantic analysis technique, and a natural semantic logic clause tree is generated by combining the subject, predicate, object, boolean operator, condition variable, and time series operator in each clause. The method comprises the following specific steps:

first, step S41 is to divide the sub-tree corresponding to the sentence node and the clause node into a syntax clause tree by recognizing the noun phrase and the verb phrase in the sentence node and the clause node of the syntax parsing tree. Taking the parsing tree of requirement one in fig. 2 as an example, in the sentence node represented by S and the Clause node represented by SBAR, through recognition of noun phrases and verb phrases, the corresponding grammatical clauses "the GAS _ conversation excepted 10", "the GAS _ conversation is below 8", and "the ALARM shell be activated" can be found out, so as to form a syntax Clause tree, and the parent node of the syntax Clause tree is defined as a class node.

Each clause is then processed separately in step S42. In order to reduce unnecessary workload, clauses are firstly subjected to word shape reduction, and for example, "am", "is" and "was" are all reduced to "be". Then extracting main, predicate and object meaning information in the clauses, wherein the main words are obtained by noun phrases in the clauses; the predicate is obtained from a verb phrase in the clause; the object is obtained from the noun phrase in the verb phrase. Taking the syntax clause trees corresponding to the aforementioned syntax clauses "the GAS _ conversation excepted 10%", "the GAS _ conversation is below 8%", and "the ALARM short belated activated" as examples, the corresponding subject, predicate, and object are { GAS _ conversation, be _ great, 10% }, { GAS _ conversation, be _ LessThan, 10% }, { ALARM, be _ TurnOn }, respectively, can be extracted.

In step S43, keyword matching is performed on each clause, and boolean operators, conditional variables, and timing operators are extracted. Boolean operatorExtracted from negative words, such as "not" and "nover". The condition variable can be extracted from some keywords in natural language, such as "if" or "where" is followed by a Clause node, and then this Clause represents the condition that the specification satisfies. The timing operators are divided into unary operators, which describe single atomic propositions, and binary operators, which describe two or more atomic propositions. The timing operator may be extracted from the adverb, such as "always" for G and "eventuality" for F.

In step S44, the subject, predicate, object, boolean operator, condition variable, and sequential operator extracted from each syntax clause tree are combined into a natural semantic logic clause tree based on the syntax analysis tree. Taking the syntax parsing tree requiring one in fig. 2 as an example, the finally obtained natural semantic logical clause tree is shown in fig. 9. Wherein, the node Clause represents a natural semantic logic Clause, Clause (R) represents a root node, Clause (C) represents a condition variable, Clause (T-B-U) represents a node with a binary operator unity, and Clause (T-U-X) represents a node with a unary operator X.

Step S5 traverses the natural semantic logic clause tree to generate a linear temporal logic convention. The specific treatment process is as follows:

first, in step S51, using a semantic translation template, the subject, predicate, and object of each clause are generated into an atomic proposition of linear sequential logical conventions in the natural semantic logical clause tree obtained in step S4. If the corresponding template can not be found, the clause structure is removed. Taking the natural semantic logical clause tree in fig. 9 as an example, three atomic propositions will be obtained through step S51:

GAS_CONCENTRATION>10,ALARM_state=ON,GAS_CONCENTRATION<8.

then step S52, traversing the tree structure from top to bottom with depth first, using the specification translation template to translate boolean, conditional and temporal operators to combine the atomic propositions into a complete linear temporal logical specification. The linear sequential logic conventions finally generated by the natural language requirement texts of the three requirements are as follows:

G(GAS_CONCENTRATION>10→X(ALARM_state=ON U GAS_CONCENTRATION<8))

G(CAMERA.NewPhoto=TRUE→MOBILE_PHONE.SendMsg=TRUE)

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:翻译方法及相关装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!