Semantic parsing


Semantic parsing is the task of converting a natural language utterance to a logical form: a machine-understandable representation of its meaning. Semantic parsing can thus be understood as extracting the precise meaning of an utterance. Applications of semantic parsing include machine translation, question answering, ontology induction, automated reasoning, and code generation. The phrase was first used in the 1970s by Yorick Wilks as the basis for machine translation programs working with only semantic representations.

Types

Shallow

Shallow semantic parsing is concerned with identifying entities in an utterance and labelling them with the roles they play. Shallow semantic parsing is sometimes known as slot-filling or frame semantic parsing, since its theoretical basis comes from frame semantics, wherein a word evokes a frame of related concepts and roles. Slot-filling systems are widely used in virtual assistants in conjunction with intent classifiers, which can be seen as mechanisms for identifying the frame evoked by an utterance. Popular architectures for slot-filling are largely variants of an encoder-decoder model, wherein two recurrent neural networks are trained jointly to encode an utterance into a vector and to decode that vector into a sequence of slot labels. This type of model is used in the Amazon Alexa spoken language understanding system.

Deep

Deep semantic parsing, also known as compositional semantic parsing, is concerned with producing precise meaning representations of utterances that can contain significant compositionality. Shallow semantic parsers can parse utterances like "show me flights from Boston to Dallas" by classifying the intent as "list flights", and filling slots "source" and "destination" with "Boston" and "Dallas", respectively. However, shallow semantic parsing cannot parse arbitrary compositional utterances, like "show me flights from Boston to anywhere that has flights to Juneau". Deep semantic parsing attempts to parse such utterances, typically by converting them to a formal meaning representation language.

Representation languages

Early semantic parsers used highly domain-specific meaning representation languages, with later systems using more extensible languages like Prolog, lambda calculus, lambda dependency-based compositional semantics, SQL, Python, Java, the Alexa Meaning Representation Language, and the Abstract Meaning Representation. Some work has used more exotic meaning representations, like query graphs, semantic graphs, or vector representations.

Models

Most modern deep semantic parsing models are either based on defining a formal grammar for a chart parser or utilizing RNNs to directly translate from a natural language to a meaning representation language. Examples of systems built on formal grammars are the Cornell Semantic Parsing Framework, Stanford University's Semantic Parsing with Execution, and the Word Alignment-based Semantic Parser.

Datasets

Datasets used for training statistical semantic parsing models are divided into two main classes based on application: those used for question answering via knowledge base queries, and those used for code generation.

Question answering

A standard dataset for question answering via semantic parsing is the Air Travel Information System dataset, which contains questions and commands about upcoming flights as well as corresponding SQL. Another benchmark dataset is the GeoQuery dataset which contains questions about the geography of the U.S. paired with corresponding Prolog. The Overnight dataset is used to test how well semantic parsers adapt across multiple domains; it contains natural language queries about 8 different domains paired with corresponding λ-DCS expressions.

Code generation

Popular datasets for code generation include two trading card datasets that link the text that appears on cards to code that precisely represents those cards. One was constructed linking card texts to Java snippets; the other by linking Hearthstone card texts to Python snippets. The IFTTT dataset uses a specialized domain-specific language with short conditional commands. The Django dataset pairs Python snippets with English and Japanese pseudocode describing them. The RoboCup dataset pairs English rules with their representations in a domain-specific language that can be understood by virtual soccer-playing robots.