WO2014190901A1 - 语法编译方法、语义解析方法、装置、计算机存储介质和设备 - Google Patents
语法编译方法、语义解析方法、装置、计算机存储介质和设备 Download PDFInfo
- Publication number
- WO2014190901A1 WO2014190901A1 PCT/CN2014/078596 CN2014078596W WO2014190901A1 WO 2014190901 A1 WO2014190901 A1 WO 2014190901A1 CN 2014078596 W CN2014078596 W CN 2014078596W WO 2014190901 A1 WO2014190901 A1 WO 2014190901A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- function
- exp
- key
- text
- grammar
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/253—Grammatical analysis; Style critique
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/211—Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
Definitions
- the present invention relates to the field of computer application technologies, and in particular, to a syntax compilation method, a semantic analysis method, an apparatus, a computer storage medium, and a device.
- Speech recognition and colloquial semantic analysis are two important technologies of speech interaction products.
- Speech recognition is the conversion of speech content into text. Spoken semantic analysis is to understand the information carried by spoken speech signals.
- the accuracy of speech recognition rate and colloquial semantic analysis directly affects the user experience.
- the two context-free grammars of the W3C (World Wide Web Consortium) specification are mainly used to construct the recognition space, that is, the grammar based on the B NF (Bacchus paradigm) form or based on The syntax of the XML (Extensible Markup Language) format.
- the present invention provides a syntax compilation method, a semantic analysis method, and a pair It should be installed to improve readability and maintainability.
- a grammar compiling method according to a common statement of semantic expression, using a logical grammar intuitive language LGML to predefine a corresponding grammar description file and a part class description file, wherein the grammar description file is composed of a word class, an operator and a function. Description, the word class description file is used to describe a specific value of a word class;
- the word class tree is hooked to the position of the corresponding word class in the syntax tree to form a grammar of the semantics.
- the part-of-speech description file includes a term, or contains at least one of an operator and a function in addition to the term to describe the relationship between the terms.
- the operator includes at least one of the following: an operator + indicates that two or more operands are connected in series;
- the operator 0 indicates that the operand forms a non-negligible combination
- the operator [] indicates that the operand forms a negligible combination
- the function in the grammar description file includes at least one of the following functions:
- the function &repeat(EXP, min, max) indicates that the 4 bar grammar fragment EXP repeats at least min times, up to max times;
- the function &repeat(EXP, n) means repeating EXP for n times;
- the function &perm(EXPl, EXP2, 7) means to make EXP1, EXP2,... do all the way to 'J;
- the function &grammar(gammar_name) represents the syntax description file whose syntax name is grammar_name;
- Function &magic(EXP, key, default, display) or function &magic(EXP, key, default) implements the mapping of EXP to semantic tag key; where function &magic(EXP, key, default) is in the syntax matching process, when EXP and one When the text fragment T matches successfully, the value of key is T, otherwise the value of key is default; function &magic(EXP, key, default, display) In the syntax matching process, when EXP matches a text fragment T successfully, key The value is display, otherwise the value of the key is default.
- the function in the part-of-speech description file includes at least one of the following functions:
- the function &repeat(EXP, min, max) represents a 4 bar grammar fragment EXP repeats at least min times, up to max times;
- the function &repeat(EXP, n) means repeating EXP for n times;
- the leaf node is a term in the word class description file or an external dictionary referenced
- the non-leaf node is an operator or a function name
- the operand of the non-leaf node is The content represented by each subtree of the non-leaf node.
- the function &magic(EXP, key, default, display) or function &magic(EXP, key, default) is used as the semantic syntax tree.
- the non-leaf node is identified, and the mapping table corresponding to the function &magic(EXP, key, default, display) or function &magic(EXP, key, default) is saved.
- a semantic parsing method comprising:
- the process of matching if a certain text segment in the text to be parsed is associated with the function &magic(EXP, key, default, display) or function &magic(EXP, key, default) If the identified subtree matches, the value of the key in the mapping table corresponding to the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) in the parsing result is the text fragment or The value of display in the mapping table.
- a semantic parsing method comprising:
- the value of the key in the mapping table corresponding to the matching function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) in the parsing result is the text segment or The value of display in the mapping table.
- only the text segment and the key function &magic(EXP, key, default, display) or key function &magic(EXP, key, default) are preset in the text to be parsed.
- the identified subtrees match, and the grammar tree is The corresponding semantics are determined as the semantics of the text to be parsed.
- a semantic parsing method comprising:
- the text to be parsed is matched according to the preset sequence in a syntax tree obtained by using the foregoing syntax compilation method, and if the to-be-analyzed text completely matches the syntax tree, the syntax tree corresponds to Semantic determination is the semantics of the text to be parsed; otherwise step S2 is performed;
- the value of the key in the mapping table corresponding to the matching function &magic(EXP key, default, display) or the function &magic(EXP, key, default) in the parsing result is the text fragment or mapping.
- the value of display in the table is the text fragment or mapping.
- a grammar compiling device comprising:
- a file storage unit configured to store a semantic corresponding grammar description file and a part-of-speech description file, wherein the grammar description file and the part-of-speech description file are pre-defined according to a semantic common expression expression, using a logic-based grammar intuitive language LGML, in the grammar
- LGML logic-based grammar intuitive language
- a syntax tree generating unit configured to generate the syntax tree of the grammar description file and the part-of-speech tree of the part-of-speech description file according to the reduction method of the grammar description file and the part-of-speech description file respectively, and attach the word class tree to the word class tree The position of the corresponding word class in the grammar tree, forming the language The grammar tree of righteousness.
- the part-of-speech description file includes a term, or contains at least one of an operator and a function in addition to the term to describe the relationship between the terms.
- the operator includes at least one of the following: an operator + indicates that two or more operands are connected in series;
- the operator 0 indicates that the operand forms a non-negligible combination
- the operator [] indicates that the operand forms a negligible combination
- the function in the grammar description file comprises at least one of the following functions:
- the function &repeat(EXP, min, max) represents a 4 bar grammar fragment EXP repeats at least min times, up to max times;
- the function &repeat(EXP, n) means repeating EXP for n times;
- the function &perm(EXPl, EXP2, 7) means to make EXP1, EXP2,... do all the way to 'J;
- the function &grammar(gammar_name) represents the syntax description file whose syntax name is grammar_name;
- Function &magic(EXP, key, default, display) or function &magic(EXP, key, default) implements the mapping of EXP to semantic tag key; where function &magic(EXP, key, default) is in the syntax matching process, when EXP and one When the text fragment T matches successfully, key The value of the key is T, otherwise the value of the key is default; the function &magic(EXP, key, default, display) In the syntax matching process, when the EXP matches a text fragment T successfully, the value of key is display, otherwise the value of key Is default.
- the function in the part-of-speech description file includes at least one of the following functions:
- the function &repeat(EXP, min, max) represents a 4 bar grammar fragment EXP repeats at least min times, up to max times;
- the function &repeat(EXP, n) means repeating EXP for n times;
- the leaf node is a term in the word class description file or an external dictionary referenced
- the non-leaf node is an operator or a function name
- the operand of the non-leaf node is The content represented by each subtree of the non-leaf node.
- the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) is identified as a non-leaf node in the semantic syntax tree, and the file is stored.
- the unit further saves the mapping table corresponding to the function &magic(EXP key, default, display) or the function &magic(EXP, key, default).
- a semantic parsing device comprising:
- a whole sentence matching unit configured to match the to-be-analyzed text on the syntax tree obtained by the syntax compiling device according to the preset order, if the whole sentence matching unit determines that the to-be-analyzed text is completely related to the syntax tree
- the matching result is sent to the result determining unit, and the result determining unit is configured to determine the semantics corresponding to the syntax tree as the semantics of the text to be parsed when the matching result is received.
- the text segment in the text is matched with the subtree identified by the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default), and the result is obtained in the parsing result obtained by the result determining unit.
- the value of the key in the mapping table corresponding to the function &magic(EXP, key, default, display) or function &magic(EXP, key, default) is the value of the display in the text fragment or mapping table.
- a semantic parsing device comprising:
- a semantic mapping matching unit configured to perform forward maximum matching on the grammar tree obtained by the grammar compiling device according to the preset order in the grammar tree obtained by the grammar compiling device, if there is a text segment and the grammar tree in the to-be-analyzed text If the subtree matched by the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) matches, the matching result is sent to the result determining unit;
- a result determining unit configured to determine, according to the matching result, the semantics corresponding to the syntax tree as the semantics of the text to be parsed.
- the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) corresponds to the key in the mapping table.
- the value is the value of display in the text fragment or mapping table.
- the semantic mapping matching unit only has a text segment and a key function &magic(EXP, key, default, display) or a key function &magic preset in the syntax tree in the text to be parsed.
- the matching result is sent to the result determining unit.
- a semantic parsing device comprising:
- a full sentence matching unit for parsing the text to be parsed in the syntax tree obtained by the grammar compiling device Matching in the preset order, if the whole sentence matching unit determines that the to-be-analyzed text completely matches the syntax tree, the matching result is sent to the result determining unit; otherwise, the semantic mapping matching unit is triggered;
- a semantic mapping matching unit configured to perform a forward maximum matching on the syntax tree according to the preset sequence after being triggered, if a text segment and the syntax tree exist in the to-be-analyzed text If the subtree matched by the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) matches, the matching result is sent to the result determining unit;
- the result determining unit is configured to determine, when the matching result is received, the semantics corresponding to the syntax tree as the semantics of the text to be parsed.
- the result determining unit receives the matching result of the semantic mapping matching unit, the matching function &magic(EXP, key, default, display) or function &magic(EXP,
- the value of the key in the mapping table corresponding to key, default) is the value of display in the text fragment or mapping table.
- the grammar compiling method and the semantic parsing method provided by the present invention are based on the LGML pre-defined grammar description file and the part-of-speech description file, which is closer to the human oral expression, compared with the BNF and XML interpretation levels. More readable and easier to maintain.
- FIG. 1a is a schematic diagram of a syntax tree of a grammar description file according to an embodiment of the present invention
- FIG. 1b, FIG. 1c and FIG. 1d are schematic diagrams of a part-of-speech tree of a part-of-speech description file according to an embodiment of the present invention
- Figure le is a schematic diagram of a semantic syntax tree provided by an embodiment of the present invention
- 2a is a schematic diagram of a syntax tree of a grammar description file according to an embodiment of the present invention
- FIG. 2b and FIG. 2c are diagrams showing an example of a word class tree of a word class description file according to an embodiment of the present invention
- FIG. 2 is a schematic diagram of a semantic syntax tree according to an embodiment of the present invention.
- FIG. 3 is a syntax tree for semantic correspondence of query weather according to an embodiment of the present invention
- FIG. 4 is a structural diagram of a syntax compiling apparatus according to an embodiment of the present invention
- FIG. 5 is a structural diagram of a first semantic parsing apparatus according to an embodiment of the present invention
- FIG. 6 is a structural diagram of a second semantic parsing apparatus according to an embodiment of the present invention
- a structural diagram of a semantic parsing device A structural diagram of a semantic parsing device.
- the grammar compilation method provided by the present invention is based on a new grammar description language, namely LGML (Logical Grammar by Manifest Language), which is different from the existing BNF or XML complex structure, and more Close to the order and description of natural spoken language.
- LGML Logical Grammar by Manifest Language
- the common expressions for each semantic expression use LGML to predefine the corresponding grammar.
- the grammar defined by LGML consists of two parts: a grammar description file and a word class description file.
- the common statement description is composed of operators, word classes and functions.
- the grammar description file usually defines various statement descriptions in an exhaustive manner. Word classes and functions are usually used as operands of operators in a grammar description file. In addition to appearing as a separate operation object in a grammar description file, a word class can also appear as a parameter in a function.
- a word class is a unified identifier for a number of terms (referring to words or phrases) that have the same meaning.
- a word class specifically contains a term defined in the word class description file corresponding to the word class, that is, the word class description file is used to describe the specific value of the word class, and the word class description file also includes operators and/or functions to describe The relationship between the terms.
- the word class description file can be manually defined or the result of machine mining can be used.
- the operators in the grammar description file and the word class description file may include but are not limited to the following:
- the operator + indicates that two or more operands are concatenated.
- the so-called concatenation is to describe the statements in order (the operator I represents the relationship of two or more operands in parallel, and the so-called parallel relationship is the same meaning of the operand alternative expression.
- 0 means that the operands form a non-negligible combination.
- the operator [] indicates that the operands form a negligible combination.
- the operator "" indicates that an external dictionary is referenced, and the vocabulary in the dictionary is a parallel relationship.
- the functions in the part-of-speech description file may include but are not limited to the following:
- the function &repeat(EXP, min, max) represents a 4 bar grammar fragment. EXP repeats at least min times, up to max times.
- the function &repeat(EXP, n) means that EXP is repeated n times.
- &perm(EXPl, EXP2, 7) means to make EXP1, EXP2,... do all the way to 'J.
- &perm(EXPl, EXP2, EXP3) is equivalent to the juxtaposition of 6 concatenations:
- the syntax description file can include but is not limited to the following functions:
- the function &grammar(gammar_name) is usually written at the beginning of the grammar file, indicating that the grammar name of a statement expression is grammar_name , which identifies the grammar description file expressed by the statement.
- the function &magic(EXP, key, default, display) and the function &magic(EXP, key, default) implement the mapping of EXP to the semantic tag key.
- the grammar description file can be defined as:
- the word class description file can be defined as: [willingness] : I + (I want I want);
- the grammar compilation provided in the present invention is to compile the semantics into a grammar tree based on LGML, and use the preset order for the grammar description file and the word class description file in the process of compiling the grammar tree (this In the embodiment of the invention, the reduction method from left to right is used, and the syntax tree generated according to the relationship between the function and the operator is generated. Specifically, the left-to-right reduction method is used to generate a syntax tree from the syntax description file, and the word class description file is generated into a word class tree by using a left-to-right reduction method, and then the word class tree is hooked in the syntax tree. Corresponding to the location of the word class, the final word class tree is attached to the leaf node of the syntax tree.
- the leaf nodes are word classes
- the non-leaf nodes are operators
- the operands of the operators that are non-leaf nodes are the contents represented by the subtrees of the non-leaf nodes. Since the functions &repeat(EXP, min, max), &repeat(EXP, n), &perm(EXPl, EXP2, ...) can all be expressed as a combination of the syntax fragment EXP and the operator, and the function &magic(EXP, key , default, display) and &magic(EXP, key, default) are implemented because of the mapping relationship. Therefore, the &magic function needs to be identified in the syntax tree.
- the way of identification can be as a non-leaf node, and the &magic function exists at the same time.
- the corresponding mapping table for example, the identifier of the &magic function and its corresponding mapping table may have a location pointing.
- the reduction is made from left to right.
- the syntax tree of the generated grammar description file is shown in Figure la.
- the leaf nodes are the word classes [A], [B], and [C]
- the non-leaf nodes are operators.
- the operands of the non-leaf nodes "+,[]" are [A] and [B]
- the non-leaf nodes ⁇ " are the contents of their subtrees
- the subtree contents of the left branch are [[A] + [B ⁇ ]
- the subtree content of the right branch is [C].
- semantic word class description file is:
- the word class is round-to-right reduced, and the word class trees corresponding to the word classes [A], [B], and [C] are shown in Figure lb, Figure lc, and Figure Id. Then, each word class tree is attached to the position of the corresponding word class on the syntax tree of the grammar description file, and finally the grammar tree of the above semantics is formed as shown in FIG.
- each word class is reduced from left to right, and the word classes [X] and [Y] are corresponding.
- the word class tree is shown in Figure 2b and Figure 2c, respectively.
- each word class tree is attached to the position of the corresponding word class on the syntax tree of the grammar description file, and finally the grammar tree forming the semantics is as shown in FIG. 2d.
- the leaf node is a term in the word class description file or an external dictionary referenced
- the non-leaf node is an operator or a function name
- the operand of the non-leaf node is the non-leaf node The content of each subtree represented.
- mapping tables of all &magic functions in the grammar description file can merge the mapping tables of all &magic functions in the grammar description file to form a mapping table for storage and query.
- the text to be parsed may be a text result such as a recognition of the user's voice, thereby semantically parsing the text result to obtain the semantics expressed by the text, or may be a text such as a user inputting a search engine, and semantically inputting the text input by the user. Parsing the semantics it expresses, etc., is no longer exhaustive.
- the text to be parsed is matched with each syntax tree, and the matching method from left to right is used in the matching, and the semantics corresponding to the matching syntax tree are determined as the semantics of the text to be parsed.
- the whole sentence matching method may be used, or the semantic mapping matching method may be adopted, or the combination of the whole sentence matching and the semantic mapping matching may be adopted, that is, the whole sentence is matched first, and if there is no matching result, the matching is performed.
- the so-called whole sentence matching is that the text to be parsed can completely match the grammar tree of a certain semantic LGML.
- This matching method is a universal and highly accurate matching method, no matter what function is used in LGML.
- the semantic mapping matching is that the text segment in the text to be parsed can match the grammar segment defined by the &magic function, that is, all or part of the text in the text to be parsed can match the subtree identified by the &magic function in the grammar tree, and the parsed text is determined.
- the semantics of the &magic The semantics of the function mapping.
- the matching manner between the text to be parsed and the syntax tree is basically the same as the matching manner of the existing syntax tree, except that the order is performed in a left-to-right order, and only the text to be parsed can be completely matched in the syntax tree. Then it is determined that the match is successful. Specifically, in the matching process, if the subtree identified by the &magic function is matched, the mapping result is obtained from the mapping table indicated by the &magic function as a result of the analysis according to the matching result of the subtree identified by the &magic function.
- the value of the key in the mapping table indicated by the &magic function in the parsing result is the display of the text segment or the mapping table. Value.
- the subtree to which it is identified can use the semantic mapping matching method, that is, the subtree identified by the &magic function is matched to the text to be parsed to the greatest extent, if there is text in the text to be parsed If the fragment matches the subtree identified by the &magic function, the semantics of the text to be parsed may be determined as the semantics of the syntax tree.
- the value of the key in the mapping table indicated by the &magic function is the text fragment. Or the value of display in the mapping table.
- the text to be parsed is eabdc
- the syntax tree is forward-matched to the text to be parsed (ie, e is matched from the beginning of the text to be parsed, if the matching is unsuccessful)
- the result is that the text fragment abd can match the syntax tree, and then the semantics of the text to be parsed can be determined as the semantics corresponding to the syntax tree, and the value of the key in the parsing result is The value of display.
- the manner of matching the semantic mapping after the whole sentence matching may be obtained, that is, if the whole sentence matches Failure to perform semantic mapping matching.
- each magic mapping table can be combined into a form of a mapping table.
- the text to be parsed is "tell me temperature"
- the relevant grammar fragment of "tell me” is not defined in the grammar
- the whole sentence fails to match, and then the semantic mapping is matched, where the text fragment "temperature” and the subtree of magic3
- the semantic mapping is successfully matched.
- the semantics of the text to be parsed can still be considered as the query weather, and magicl is mapped to "today”.
- Magic2 maps to "LBS” and magic3 maps to "weather”, so the value of date in the parsing result is "today”, the value of place is “LBS”, and the value of weather is "weather”.
- the key magic function can be set in the semantic mapping matching process. Only when the subtree corresponding to the key magic function is successfully matched, the semantic mapping is successfully matched.
- the magic3 function in the syntax tree shown in Figure 3 can be set as a key magic function, and only if the subtree corresponding to the magic function matches successfully, the semantic mapping is successfully matched. For example, when the text to be parsed is "I want to know Beijing", although "I want to know Beijing" the entire sentence fails to match, but the "Beijing" text fragment matches the subtree corresponding to the magic2 function, but due to the key If the magic3 function does not match successfully, the semantic mapping will not be considered as a successful error. The text to be parsed cannot be considered as the semantics of the query weather.
- FIG. 4 is a structural diagram of a syntax compiling apparatus according to an embodiment of the present invention.
- the syntax compiling apparatus mainly includes a file storage unit 41 and a syntax tree generating unit 42.
- the file storage unit 41 stores a semantically corresponding grammar description file and a part-of-speech description file.
- the grammar description file and the part-of-speech description file are expressed in accordance with semantic common expressions, which are pre-defined based on LGML, and the word class, the operator and the function in the grammar description file.
- semantic common expressions which are pre-defined based on LGML, and the word class, the operator and the function in the grammar description file.
- the word class description file is used to describe the specific value of the word class.
- the above operators may include, but are not limited to, at least one of the following operators:
- the operator + indicates that more than two operands are concatenated
- the operator 0 indicates that the operand forms a non-negligible combination
- the operator [] indicates that the operand forms a negligible combination
- the functions in the part-of-speech description file may include but are not limited to the following:
- the function &repeat(EXP, min, max) represents a 4 bar grammar fragment. EXP repeats at least min times, up to max times.
- the function &repeat(EXP, n) means that EXP is repeated n times.
- &perm(EXPl, EXP2, 7) means to make EXPl, EXP2,... do all the way to 'J.
- &perm(EXPl, EXP2, EXP3) is equivalent to the juxtaposition of 6 concatenations:
- the function &grammar(gammar_name) is usually written at the beginning of the grammar file, indicating that the grammar name of a statement expression is grammar_name, which identifies the grammar description file expressed by the statement.
- the function &magic(EXP, key, default, display) and the function &magic(EXP, key, default) implement the mapping of the EXP to the semantic tag key.
- the syntax tree generating unit 42 is responsible for generating a syntax tree of the grammar description file and a word class tree of the word class description file according to a reduction method of the grammar description file and the part class description file in a preset order (for example, using a left-to-right order),
- the word class tree is attached to the position of the corresponding word class in the syntax tree to form a semantic syntax tree.
- the leaf nodes are word classes
- the non-leaf nodes are operators
- the operands of the operators that are non-leaf nodes are the contents represented by the subtrees of the non-leaf nodes. Since the functions &repeat(EXP, min, max), &repeat(EXP, n), &perm(EXPl, EXP2, ...) can all be expressed as a combination of the syntax fragment EXP and the operator, and the function &magic(EXP, key , default, display) and &magic(EXP, key, default) are implemented because of the mapping relationship. Therefore, the &magic function needs to be identified in the syntax tree. The identification can be performed as a non-leaf node, and the &magic can be further saved.
- the semantic mapping corresponding to the function for example, the location of the &magic function identifier and its corresponding mapping table may exist.
- the leaf node is a term in the word class description file or an external dictionary referenced
- the non-leaf node is an operator or a function name
- the operand of the non-leaf node is each child of the non-leaf node.
- the content represented by the tree If there are more than two &magic functions in the grammar description file, the mapping tables of all &magic functions in the grammar description file can be merged to form a mapping table for convenient storage and query.
- the semantic parsing apparatus provided by the present invention can be implemented by using three structures, one simply using the whole sentence matching method, and the other simply using the semantic mapping.
- FIG. 5 is a structural diagram of a first semantic parsing apparatus according to an embodiment of the present invention.
- the semantic parsing apparatus uses a whole sentence matching manner. As shown in FIG. 5, the semantic parsing apparatus includes: a whole sentence matching unit 51 and Result determination unit 52.
- the whole sentence matching unit 51 matches the to-be-analyzed texts on the syntax tree of the above semantics in a preset order. If it is determined that the to-be-analyzed text completely matches the syntax tree, the matching result is sent to the result determining unit 52.
- the semantics corresponding to the syntax tree are determined as the semantics of the text to be parsed.
- the sub-tree identified by the &magic function may be matched during the entire sentence matching process, if a text fragment in the text to be parsed is associated with the function &magic(EXP, key, default, display) or the function &magic(EXP, key, If the subtrees identified by the defaults match, the key of the mapping table corresponding to the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) in the parsing result obtained by the result determining unit 52 is taken. Value is the text fragment Or the value of display in the mapping table.
- FIG. 6 is a structural diagram of a second semantic parsing apparatus according to an embodiment of the present invention.
- the semantic parsing apparatus uses semantic mapping matching only, and the method is applied to a syntax tree including a subtree identified by a &magic function.
- the semantic parsing apparatus includes: a semantic mapping matching unit 61 and a result determining unit 62.
- the semantic mapping matching unit 61 performs forward maximum matching on the semantic syntax tree of the to-be-parsed text according to a preset order, if there is a function in the text to be parsed and a function &magic(EXP, key, default, display) or function in the syntax tree If the subtrees identified by &magic(EXP, key, default) match, the matching result is sent to the result determining unit 62.
- the result determining unit 62 determines the semantics corresponding to the syntax tree as the semantics of the text to be parsed upon receiving the matching result. Further, in the analysis result obtained by the result determining unit 62, the value of the key in the mapping table corresponding to the function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) is the text segment or The value of display in the mapping table.
- the key magic function can be set in the semantic mapping matching process. Only when the subtree corresponding to the key magic function is successfully matched, the semantic mapping is successfully matched. That is, the semantic mapping matching unit 61 only has the sub-tree identified by the key function &magic(EXP, key, default, display) or the key function &magic(EXP, key, default) preset in the text segment and the syntax tree in the text to be parsed. When the match is made, the matching result is sent to the result determining unit 62.
- FIG. 7 is a structural diagram of a third semantic parsing apparatus according to an embodiment of the present invention.
- the semantic parsing apparatus uses a combination of whole sentence matching and semantic mapping matching, wherein the semantic mapping matching is generally applicable to a syntax tree containing a &magic function. The case of the corresponding subtree.
- the semantic parsing apparatus includes: a whole sentence matching unit 71, a semantic mapping matching unit 72, and a result.
- the unit 73 is determined.
- the whole sentence matching unit 71 matches the to-be-analyzed text in a semantic sequence on the semantic syntax tree. If the whole sentence matching unit 71 determines that the to-be-analyzed text completely matches the syntax tree, the matching result is sent to the result determining unit 73; otherwise The semantic mapping matching unit 72 is triggered.
- the text to be parsed is forward-forwarded in the predetermined order in the syntax tree. If there is a function in the text to be parsed and the function in the syntax tree &magic(EXP, key, default, display) Or the subtrees identified by the function &magic(EXP, key, default) match, and the matching result is sent to the result determining unit 73.
- the result determining unit 73 can determine the semantics corresponding to the syntax tree as the semantics of the text to be parsed, regardless of whether the matching result of the whole sentence matching unit 71 or the matching result of the semantic mapping matching unit 72 is received.
- the result determining unit 73 receives the matching result of the semantic mapping matching unit 72, the matching function &magic(EXP, key, default, display) or the function &magic(EXP, key, default) in the analysis result corresponds to
- the value of the key in the mapping table is the value of the display in the text fragment or mapping table.
- the key magic function can be set, and only if the subtree corresponding to the key magic function is successfully matched, the semantic mapping is successfully matched. That is, the semantic mapping matching unit 72 only has a key function &magic(EXP, key, default, display) or a key function preset in the text segment and the syntax tree in the text to be parsed.
- the matching result is sent to the result determining unit 73.
- the syntax trees of each semantic are usually matched one by one to determine the semantics corresponding to the text to be parsed, in an embodiment of the present invention.
- the descriptions are made by taking a match on a syntax tree as an example, and the matching process for each syntax tree is the same.
- multi-level semantic analysis is used, and then the semantic analysis method and the semantic analysis device provided by the embodiments of the present invention can be implemented in each level of semantic analysis.
- the disclosed apparatus and method can be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the units is only a logical function division, and the actual implementation may have another division manner.
- the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
- the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
- the software functional unit is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform the method of various embodiments of the present invention. Part of the steps.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a Read-Only Memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Machine Translation (AREA)
Abstract
Description
Claims
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| KR1020157033354A KR101726667B1 (ko) | 2013-05-28 | 2014-05-28 | 어법컴파일방법, 어의해석방법, 디바이스, 컴퓨터 저장매체 및 장치 |
| JP2016515634A JP6238494B2 (ja) | 2013-05-28 | 2014-05-28 | 文法コンパイル方法、語義解析方法、及び装置 |
| US14/892,818 US20160124936A1 (en) | 2013-05-28 | 2014-05-28 | Grammar compiling methods, semantic parsing methods, devices, computer storage media, and apparatuses |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310203987.2 | 2013-05-28 | ||
| CN201310203987.2A CN103294666B (zh) | 2013-05-28 | 2013-05-28 | 语法编译方法、语义解析方法以及对应装置 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2014190901A1 true WO2014190901A1 (zh) | 2014-12-04 |
Family
ID=49095560
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2014/078596 Ceased WO2014190901A1 (zh) | 2013-05-28 | 2014-05-28 | 语法编译方法、语义解析方法、装置、计算机存储介质和设备 |
Country Status (5)
| Country | Link |
|---|---|
| US (1) | US20160124936A1 (zh) |
| JP (1) | JP6238494B2 (zh) |
| KR (1) | KR101726667B1 (zh) |
| CN (1) | CN103294666B (zh) |
| WO (1) | WO2014190901A1 (zh) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110928550A (zh) * | 2019-11-19 | 2020-03-27 | 上海工程技术大学 | 基于关键词Trie树消除GCC抽象语法树冗余的方法 |
| CN110968634A (zh) * | 2019-12-03 | 2020-04-07 | 普元信息技术股份有限公司 | 大数据场景下基于xml描述实现利用可编程函数式进行etl转换处理的方法 |
| CN112114812A (zh) * | 2020-08-26 | 2020-12-22 | 中国船舶重工集团公司第七一六研究所 | 一种应用于工业机器人编程语言的语法检查方法 |
| CN112287663A (zh) * | 2020-11-25 | 2021-01-29 | 平安数字信息科技(深圳)有限公司 | 一种文本解析方法、设备、终端及存储介质 |
Families Citing this family (27)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103294666B (zh) * | 2013-05-28 | 2017-03-01 | 百度在线网络技术(北京)有限公司 | 语法编译方法、语义解析方法以及对应装置 |
| US11100291B1 (en) | 2015-03-13 | 2021-08-24 | Soundhound, Inc. | Semantic grammar extensibility within a software development framework |
| CN105912521A (zh) * | 2015-12-25 | 2016-08-31 | 乐视致新电子科技(天津)有限公司 | 一种解析语音内容的方法及装置 |
| CN106933832A (zh) * | 2015-12-30 | 2017-07-07 | 中国科学院沈阳自动化研究所 | 一种油藏的数字字典的构建方法 |
| CN106228983B (zh) * | 2016-08-23 | 2018-08-24 | 北京谛听机器人科技有限公司 | 一种人机自然语言交互中的场景处理方法及系统 |
| CN108399919A (zh) * | 2017-02-06 | 2018-08-14 | 中兴通讯股份有限公司 | 一种语义识别方法和装置 |
| US11106867B2 (en) | 2017-08-15 | 2021-08-31 | Oracle International Corporation | Techniques for document marker tracking |
| CN107704450B (zh) * | 2017-10-13 | 2020-12-04 | 威盛电子股份有限公司 | 自然语言识别设备以及自然语言识别方法 |
| CN109841210B (zh) * | 2017-11-27 | 2024-02-20 | 西安中兴新软件有限责任公司 | 一种智能操控实现方法及装置、计算机可读存储介质 |
| CN108021559B (zh) * | 2018-02-05 | 2022-05-03 | 威盛电子股份有限公司 | 自然语言理解系统以及语意分析方法 |
| CN108228191B (zh) * | 2018-02-06 | 2022-01-25 | 威盛电子股份有限公司 | 语法编译系统以及语法编译方法 |
| CN109254776B (zh) * | 2018-09-29 | 2022-02-01 | 深圳市雷赛控制技术有限公司 | 多语言代码编译方法及编译器 |
| CN109783806B (zh) * | 2018-12-21 | 2023-05-02 | 众安信息技术服务有限公司 | 一种利用语义解析结构的文本匹配方法 |
| CN110109676B (zh) * | 2019-04-30 | 2023-10-17 | 努比亚技术有限公司 | 编译方法、终端及计算机可读存储介质 |
| CN110109681B (zh) * | 2019-05-08 | 2023-06-09 | 上海携程商务有限公司 | 不同平台间代码的转换方法及系统 |
| CN110471666A (zh) * | 2019-07-18 | 2019-11-19 | 五八有限公司 | 代码自动转换方法和装置、代码转换器及介质 |
| CN110826314B (zh) * | 2019-11-07 | 2023-08-22 | 中金智汇科技有限责任公司 | 一种规则解析方法、装置、电子设备及存储介质 |
| KR20210061141A (ko) * | 2019-11-19 | 2021-05-27 | 삼성전자주식회사 | 자연어 처리 방법 및 장치 |
| CN112069801B (zh) * | 2020-09-14 | 2024-09-20 | 深圳前海微众银行股份有限公司 | 基于依存句法的句子主干抽取方法、设备和可读存储介质 |
| CN112256837B (zh) * | 2020-11-05 | 2022-07-12 | 思必驰科技股份有限公司 | 语义解析方法和装置 |
| CN112908488B (zh) * | 2021-02-09 | 2022-03-11 | 北京药明津石医药科技有限公司 | 事件识别方法、装置、计算机设备和存储介质 |
| CN113408299B (zh) * | 2021-06-30 | 2022-03-25 | 北京百度网讯科技有限公司 | 语义表示模型的训练方法、装置、设备和存储介质 |
| CN114089960B (zh) * | 2021-10-11 | 2024-10-25 | 阿里云计算有限公司 | 对象处理方法以及装置 |
| CN114443048B (zh) * | 2021-12-30 | 2025-05-06 | 天翼云科技有限公司 | 一种基于文本的编译方法、装置、电子设备及存储介质 |
| CN115145584B (zh) * | 2022-07-15 | 2024-11-26 | 杭州博盾习言科技有限公司 | 语法分析器的生成方法、数据处理方法、介质、设备 |
| EP4587950A1 (en) * | 2022-09-16 | 2025-07-23 | Telefonaktiebolaget LM Ericsson (publ) | Method and system to implement privacy-preserving collaborative semantic mapping |
| CN118332586B (zh) * | 2024-03-21 | 2025-11-11 | 成都飞机工业(集团)有限责任公司 | 一种基于语法树的文本分级脱敏方法、系统及存储介质 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5559693A (en) * | 1991-06-28 | 1996-09-24 | Digital Equipment Corporation | Method and apparatus for efficient morphological text analysis using a high-level language for compact specification of inflectional paradigms |
| CN101814065A (zh) * | 2009-02-23 | 2010-08-25 | 富士通株式会社 | 句法分析装置及句法分析方法 |
| CN103294666A (zh) * | 2013-05-28 | 2013-09-11 | 百度在线网络技术(北京)有限公司 | 语法编译方法、语义解析方法以及对应装置 |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3709305B2 (ja) * | 1999-07-01 | 2005-10-26 | 日立オムロンターミナルソリューションズ株式会社 | 地名文字列照合方法、地名文字列照合装置、地名文字列認識装置及び郵便物区分システム |
| JP2007102530A (ja) * | 2005-10-05 | 2007-04-19 | Advanced Telecommunication Research Institute International | 特定言語の文法を生成する装置 |
| JP4451435B2 (ja) * | 2006-12-06 | 2010-04-14 | 本田技研工業株式会社 | 言語理解装置、言語理解方法、及び、コンピュータプログラム |
| KR101092363B1 (ko) * | 2008-12-22 | 2011-12-09 | 한국전자통신연구원 | 중한자동번역을 위한 한국어 연결어미 생성 방법 및 그 장치 |
| US8892419B2 (en) * | 2012-04-10 | 2014-11-18 | Artificial Solutions Iberia SL | System and methods for semiautomatic generation and tuning of natural language interaction applications |
-
2013
- 2013-05-28 CN CN201310203987.2A patent/CN103294666B/zh active Active
-
2014
- 2014-05-28 JP JP2016515634A patent/JP6238494B2/ja not_active Expired - Fee Related
- 2014-05-28 US US14/892,818 patent/US20160124936A1/en not_active Abandoned
- 2014-05-28 KR KR1020157033354A patent/KR101726667B1/ko not_active Expired - Fee Related
- 2014-05-28 WO PCT/CN2014/078596 patent/WO2014190901A1/zh not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5559693A (en) * | 1991-06-28 | 1996-09-24 | Digital Equipment Corporation | Method and apparatus for efficient morphological text analysis using a high-level language for compact specification of inflectional paradigms |
| CN101814065A (zh) * | 2009-02-23 | 2010-08-25 | 富士通株式会社 | 句法分析装置及句法分析方法 |
| CN103294666A (zh) * | 2013-05-28 | 2013-09-11 | 百度在线网络技术(北京)有限公司 | 语法编译方法、语义解析方法以及对应装置 |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110928550A (zh) * | 2019-11-19 | 2020-03-27 | 上海工程技术大学 | 基于关键词Trie树消除GCC抽象语法树冗余的方法 |
| CN110928550B (zh) * | 2019-11-19 | 2023-11-24 | 上海工程技术大学 | 基于关键词Trie树消除GCC抽象语法树冗余的方法 |
| CN110968634A (zh) * | 2019-12-03 | 2020-04-07 | 普元信息技术股份有限公司 | 大数据场景下基于xml描述实现利用可编程函数式进行etl转换处理的方法 |
| CN110968634B (zh) * | 2019-12-03 | 2024-02-02 | 普元信息技术股份有限公司 | 大数据场景下基于xml描述实现利用可编程函数式进行etl转换处理的方法 |
| CN112114812A (zh) * | 2020-08-26 | 2020-12-22 | 中国船舶重工集团公司第七一六研究所 | 一种应用于工业机器人编程语言的语法检查方法 |
| CN112287663A (zh) * | 2020-11-25 | 2021-01-29 | 平安数字信息科技(深圳)有限公司 | 一种文本解析方法、设备、终端及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| US20160124936A1 (en) | 2016-05-05 |
| CN103294666A (zh) | 2013-09-11 |
| JP6238494B2 (ja) | 2017-11-29 |
| CN103294666B (zh) | 2017-03-01 |
| KR20160004325A (ko) | 2016-01-12 |
| JP2016526224A (ja) | 2016-09-01 |
| KR101726667B1 (ko) | 2017-04-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6238494B2 (ja) | 文法コンパイル方法、語義解析方法、及び装置 | |
| US11657816B2 (en) | Developer voice actions system | |
| US9858039B2 (en) | Voice recognition of commands extracted from user interface screen devices | |
| CN108984529B (zh) | 实时庭审语音识别自动纠错方法、存储介质及计算装置 | |
| CN110121705B (zh) | 将语用学原理应用于与可视分析交互的系统和方法 | |
| US10585924B2 (en) | Processing natural-language documents and queries | |
| US8117023B2 (en) | Language understanding apparatus, language understanding method, and computer program | |
| CN105531758B (zh) | 使用外国单词语法的语音识别 | |
| CN112559689B (zh) | 一种基于车载问答的数据处理方法和装置 | |
| US20120072204A1 (en) | Systems and methods for normalizing input media | |
| CN108399919A (zh) | 一种语义识别方法和装置 | |
| WO2015195744A1 (en) | Syntactic parser assisted semantic rule inference by generation of alternate parse trees | |
| US9892191B2 (en) | Complex query handling | |
| WO2007144853A2 (en) | Method and apparatus for performing customized paring on a xml document based on application | |
| US20180349344A1 (en) | Hybrid grammatical and ungrammatical parsing | |
| CN110268472B (zh) | 用于自动化对话系统的检测机构 | |
| US8812294B2 (en) | Translating phrases from one language into another using an order-based set of declarative rules | |
| US20060212859A1 (en) | System and method for generating XML-based language parser and writer | |
| US11086937B2 (en) | Speech based structured querying | |
| CN112823332B (zh) | 语义行业术语 | |
| WO2017016286A1 (zh) | 一种多语言语义解析的方法和装置 | |
| US20210109960A1 (en) | Electronic apparatus and controlling method thereof | |
| CN106156110B (zh) | 文本语义理解方法及系统 | |
| KR100921563B1 (ko) | 의존 문법 구문 트리를 이용한 문장 요약 방법 | |
| CN108984600B (zh) | 交互处理方法、装置、计算机设备及可读介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14804799 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 14892818 Country of ref document: US |
|
| ENP | Entry into the national phase |
Ref document number: 20157033354 Country of ref document: KR Kind code of ref document: A |
|
| ENP | Entry into the national phase |
Ref document number: 2016515634 Country of ref document: JP Kind code of ref document: A |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 14804799 Country of ref document: EP Kind code of ref document: A1 |