Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

Programmable Linguistic Interface

With powerful grammar primitives and immediate access to hundreds of built-in natural-language token types, the Wolfram Language provides a streamlined system for creating custom natural-language interfacesand deploying them to the cloud for use in programs, notebooks, forms, and APIs.


GrammarRules symbolic representation of grammar rules

CloudDeploy deploy grammar rules to the cloud

GrammarApply attempt to parse input using a specified grammar

Interpreter use a deployed grammar in a form, API, etc.

Grammar Elements

"string" literal text string

StringExpression arbitrary string pattern

RegularExpression regular expression in standard notation

GrammarToken match built-in natural-language domains or define custom ones

Restricted specify restrictions for built-in grammar tokens

Grammar Construction Primitives

Alternatives (|) multiple alternative forms

OptionalElement optionally omitted form, possibly with default

FixedOrder forms that must appear in a fixed order

AnyOrder forms that can appear in any order

Repeated (..) a form that can be repeated any number of times

DelimitedSequence form repeated with delimiters in between

Pattern (:) assign a name to use in the grammar action

CaseSensitive specify that a form must be matched case sensitively

Whitespace  ▪  NoWhitespace  ▪  DigitCharacter  ▪  LetterCharacter

Grammar Actions

RuleDelayed () define an action to perform when a match is found

Rule () specify tokens to represent subgrammars

Grammar Options

IgnoreCase specify whether to ignore uppercase versus lowercase distinctions

AllowLooseGrammar whether to allow extra grammatical "fluff"

AmbiguityFunction specify how to handle parsing of ambiguities