Setting Up Input Interpreters

The Wolfram Language provides a uniform mechanism for specifying how inputs of different types should be interpreted as Wolfram Language or WDF expressions, for example in forms or APIs. The interpretations can involve either structural or semantic conversions, and the specification of the interpretation can be used to generate interface elements such as input fields for requesting input suitable for interpretation in a form.

ReferenceReference

Interpreter define how input should be interpreted, either directly or in APIs or forms

Arbitrary Inputs & Expressions

"SemanticExpression" any natural language input, interpreted semantically

"Expression" an expression in Wolfram Language syntax

"InactiveExpression" an expression in Wolfram Language syntax, returned inactivated

"HeldExpression" an expression returned unevaluated with HoldComplete

"InactiveSemanticExpression"  ▪  "HeldSemanticExpression"

AmbiguityFunction option for handling ambiguities in semantic interpretation

Strings

"String" pure string, left as a string (deployed as a single-line field)

"TextArea" text string of any length (deployed as a multiline text field)

"TextLine" single-line text string

"URLString" string with URL encoding (e.g. "a+%CE%B1")

Restricted restrict to strings matching a pattern, or with a maximum length

Numbers

"Number" any number in a standard format (e.g. "67", "6.78", "6.78e+10")

"Integer" whole number (with range restricted using Restricted)

"SemanticNumber" number derived semantically (e.g. "2.5 million", "three quarters")

"ComputedNumber" number derived by computation (e.g. "2+2", "sqrt(13)")

"SemanticInteger" number derived semantically (e.g. "seventy-four")

NumberPoint option for specifying decimal number point to assume

Restricted restrict range of numbers

Math-Related

"MathExpression" mathematical expression (e.g. "sin(2x)+1")

"MathFormula" mathematical formula (e.g. "2x+3y=0")

"HeldMathExpression"  ▪  "InactiveMathExpression"  ▪  "HeldMathFormula"

"ComplexNumber" complex (or real) number (e.g. "2+i")

Web etc. Related

"URL" correctly formatted URL (e.g. "http://www.wolfram.com")

"SemanticURL" semantically derived URL (e.g. "wolfram website")

"IPAddress"  ▪  "URLQueryString"  ▪  "HexInteger"  ▪  "URLString"

Email & Phone Numbers

"EmailAddress" correctly formatted email address (e.g. "me@example.com")

"PhoneNumber" correctly formatted phone number

Dates & Times

"Date" date in any standard format, disambiguated by geo location

"Time" time of day (defaulting to geo location time zone)

"ComputedDate" date derived by computation (e.g. "next Tuesday")

"DateTime"  ▪  "ComputedDateTime"  ▪  "ComputedTime"

"StructuredDate" date with a particular format (chosen with a date picker on forms)

"StructuredTime"  ▪  "StructuredDateTime"

DateFormat option for specifying date formats to accept

TimeZone option for specifying time zone to assume

Restricted restrict to dates in a certain range

Colors

"Color" color (specified by name, or with a picker in a form)

"ComputedColor" color derived by computation (e.g. "red+blue")

"StructuredColor" color in a structured form (chosen with a picker on forms)

Quantities

"Quantity" quantity with units (e.g. "4.5 km", "10 ft 6 in", "30C", "7 m/s")

"ComputedQuantity" quantity derived by computation (e.g. "6.7GB / 2hrs")

"StructuredQuantity" quantity given specifically as number followed by unit

"PhysicalQuantity" physical quantity (e.g. "mass", "data transfer rate")

Restricted restrict quantities to particular units, unit types, or sizes

Currency

"CurrencyAmount" any standard currency amount (e.g. "$5", "45 pesos", "10.25 GBP")

"CurrencyName" any currency name (e.g. "USD", "US dollars")

"ComputedCurrencyAmount" currency amount derived by computation (e.g. "US debt")

Locations

"Location" anything that yields a geo location (e.g. "eiffel tower")

"GeoCoordinates" latitude, longitude geo coordinates (e.g. "17W 20.6N")

"StreetAddress" street address (e.g. "123 Broadway, NYC")

"ComputedLocation" location derived by computation (e.g. "center of illinois")

Restricted restrict to be within a certain region (e.g. country or lat-long range)

Entities »

"Country" any country or territory (e.g. "USA", "U.S.", "st helena")

"City"  ▪  "USState"  ▪  "ZIPCode"  ▪  "USCounty"  ▪  "SchoolDistrict"  ▪  ...

"Company"  ▪  "University"  ▪  "Language"  ▪  "GivenName"  ▪  "Person"  ▪  ...

"Animal"  ▪  "Chemical"  ▪  "Movie"  ▪  "Religion"  ▪  "FileFormat"  ▪  ...

Restricted restrict to a particular class of entities of a given type

Entity Classes

"CountryClass" a class of countries or territories (e.g. "Europe", "NATO")

"USStateClass"  ▪  "USCountyClass"  ▪  "AdministrativeDivisionClass"  ▪  ...

"ChemicalClass"  ▪  "FinancialIndexClass"  ▪  "BookClass"  ▪  ...

"MountainClass"  ▪  "MovieClass"  ▪  "AstronomicalObjectClass"  ▪  ...

Choices

"Boolean" Boolean value, yielding True/False (e.g. "true"/"false", "y"/"n", "1"/"0")

List, Association rules giving choices and corresponding values

Alternatives (|) several alternative interpretation forms, tried in order

Structured Input

DelimitedSequence sequence of forms delimited by comma, space, etc.

Files

"UploadedFile" file to be uploaded to the cloud (returning the cloud object)

"CachedFile" file to be cached in a temporary directory (returning the file name)

"FileName" name of a file on your computer

Non-Textual Input »

"Sound" a sound, potentially requested from a microphone

"Image" an image, potentially requested from a camera

"GIF"  ▪  "PNG"  ▪  "WAV"  ▪  "CSV"  ▪  "XLS"  ▪  "TeX"  ▪  "KML"  ▪  "SMILES"  ▪  "PLY"  ▪  ...

"Bit"  ▪  "Byte"  ▪  "Integer8"  ▪  "Integer32"  ▪  "Real64"  ▪  ...

$InterpreterTypes a list of supported interpreters

Restricted define a restriction on what to accept

Failure representation of an interpretation failure, including typical form field message

Using Input Interpreters

FormObject define the structure of a form with parameters to interpret

FormFunction define a form to evaluate involving parameters

APIFunction define an API with parameters to interpret

EmbedCode create embed code that converts parameters from external environments

Other Input Interpretation Functions »

SemanticInterpretation  ▪  Import  ▪  SemanticImport  ▪  ...