"SemanticExpression" (Interpreter Type)
-
See Also
- Interpreter
- SemanticImport
- Restricted
- Failure
-
- Interpreter Types
- Expression
- HeldExpression
- InactiveExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- MathExpression
- MathFormula
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldMathFormula
- InactiveMathFormula
- ComputedWolframLanguageSymbol
- Related Guides
-
-
See Also
- Interpreter
- SemanticImport
- Restricted
- Failure
-
- Interpreter Types
- Expression
- HeldExpression
- InactiveExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- MathExpression
- MathFormula
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldMathFormula
- InactiveMathFormula
- ComputedWolframLanguageSymbol
- Related Guides
-
See Also
"SemanticExpression" (Interpreter Type)
Wolfram Language expression given in natural language.
Details
- "SemanticExpression" can be used in Interpreter and related constructs, including deployed smart form fields.
- Use of "SemanticExpression" requires connectivity to the Wolfram Cloud.
Restriction Specifications
-
Restricted["SemanticExpression",{{choice1,…}}] one among choices Restricted["SemanticExpression",symbols] an expression involving only the given symbols (All, Automatic, or an explicit list) Restricted["SemanticExpression",symbols,contexts] an expression involving only the given symbols or symbols in the given contexts (All, Automatic, or an explicit list) Restricted["SemanticExpression",symbols,contexts,resultcontext] an expression involving only the given symbols or symbols in the given contexts, where the new symbols are created in resultcontext
Interpretation
- "SemanticExpression" can yield any Wolfram Language expression.
Examples
Basic Examples (6)
Interpreter["SemanticExpression"]["int sin(x) from -pi to pi"]Interpreter["SemanticExpression"]["population of Italy"]Interpreter["SemanticExpression"]["distance from Gabon to Pakistan"]Restrict to a list of choices:
Interpreter[Restricted["SemanticExpression", {{Entity["Bridge", "PonteVecchio"], Entity["Artwork", "David::Michelangelo"], Entity["Building", "PalazzoDegliUffizi"]}}]]["Michelangelo's David"]By default, all symbols are allowed. Restrict to a list of allowed symbols:
Interpreter[Restricted["SemanticExpression", {Plus, Times, Equal}]]["6*4==16+8"]Interpreter[Restricted["SemanticExpression", {Plus, Times, Equal}]]["6/4==16+8"]By default, new symbols are created in $Context, but a custom context can be specified:
Interpreter[Restricted["SemanticExpression", All, Automatic, Automatic]]["y + 2"]
Context[y]Interpreter[Restricted["SemanticExpression", All, Automatic, "mycontext`"]]["j + 2"]
Context[j]Specify contexts for the allowed and output symbols:
mycontext`b = 10;
Interpreter[Restricted["SemanticExpression", Automatic, {"mycontext`", "System`"}, "mycontext`"]]["a+b"]
Context[a]Prevent the creation of any new symbol:
Interpreter[Restricted["SemanticExpression", Automatic, Automatic, None]]["cos(pi)"]Interpreter[Restricted["SemanticExpression", Automatic, Automatic, None]]["cos(x)"]See Also
Interpreter SemanticImport Restricted Failure
Interpreter Types: Expression HeldExpression InactiveExpression HeldSemanticExpression InactiveSemanticExpression MathExpression MathFormula WolframLanguageSymbol HeldMathExpression InactiveMathExpression HeldMathFormula InactiveMathFormula ComputedWolframLanguageSymbol
Related Guides
History
Introduced in 2014 (10.0)