Wolfram Language Fast Introduction for Programmers
Get Started »

Interpreters

Wolfram Language interpreters do sophisticated semantic processing relying on linguistic information in the Wolfram Knowledgebase. Even with third-party libraries, this kind of functionality is not readily available for Java.

There is no comparable analogue to Interpreter in Python. Python typically requires custom code or third-party libraries to semantically interpret natural language.

Use Interpreter to interpret many types of natural-language and other input:

numbers dates colors locations languages movies chemicals images ...

In[1]:=
X
Out[1]=
In[2]:=
X
Out[2]=

Interpreter handles semantic types that require interpretation of meaning:

In[1]:=
X
Out[1]=

It also handles types that require computation:

In[2]:=
X
Out[2]=

Restricted lets you restrict allowed inputs (e.g. numbers only in a certain range).

QUICK REFERENCE: Setting Up Interpreters »

Check Your Understanding

Which of these inputs will return a date?

Interpreter["Date"]["1 Jan 2016"]

Correct.

Interpreter["Date", "1 Jan 2016"]

Incorrect. Interpreter takes one argument, which is the interpreter type, and returns a function to apply to the date.

Interpreter["1 Jan 2016"]["Date"]

Incorrect. The interpretation type comes first, and the value to be interpreted comes second.

Which of the following is appropriate to use for the interpreter function Interpreter["Date"]?

"Los Angeles"

Incorrect. This would be appropriate for interpreters such as "City" or "Location".

"one half"

Incorrect. This would be appropriate for interpreters such as "SemanticNumber".

"July 27, 1990"

Correct.

Which of these inputs will return a city?

Interpreter["ComputedCity"]["largest city"]

Correct.

Interpreter["ComputedCity"]["one half"]

Incorrect. The semantic type needs to correspond to a city.

Interpreter["SemanticNumber"]["largest city"]

Incorrect. The first argument needs to be something that will give a city.