OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Interpret numbers:

Interpreter["SemanticNumber"]["3"]

Interpreter["SemanticNumber"]["6.0098e7"]

Interpreter["SemanticNumber"]["6.0098`2"]

Interpret numbers in natural language:

Interpreter["SemanticNumber"]["two thirds"]

Interpreter["SemanticNumber"]["six"]

Restrict in a range:

Interpreter[Restricted["SemanticNumber",{1,3}]][{"one", "two","three","four"}]

Restrict to the first five prime numbers:

Interpreter[Restricted["SemanticNumber", {Prime/@Range[5]}]]["five"]

Restrict to odd numbers below 100:

Interpreter[Restricted["SemanticNumber", {1,100,2}]]["seventeen"]

Set the precision:

Interpreter[Restricted["SemanticNumber",Automatic,10]]["one third"]

Otherwise, (RefLink[$MachinePrecision, paclet:ref/$MachinePrecision]) is implied:

Interpreter["SemanticNumber"]["one third"]//Precision

When the number contains a (RefLink[Precision, paclet:ref/Precision]) or (RefLink[Accuracy, paclet:ref/Accuracy]), and a precision restriction is also specified, the lower of the two will be applied:

Interpreter[Restricted["ComputedNumber",Automatic,3]]["1.23456789`8"]

Interpreter[Restricted["ComputedNumber",Automatic,2]]["1.23456789``10"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[SemanticImport, paclet:ref/SemanticImport])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])  ▪  (RefLink[Integer, paclet:ref/Integer])  ▪  (RefLink[Rational, paclet:ref/Rational])  ▪  (RefLink[Real, paclet:ref/Real])}, {Related Interpreter Types:  (RefLink[Number, paclet:ref/interpreter/Number])  ▪  (RefLink[ComputedNumber, paclet:ref/interpreter/ComputedNumber])  ▪  (RefLink[Integer, paclet:ref/interpreter/Integer])  ▪  (RefLink[Digit, paclet:ref/interpreter/Digit])  ▪  (RefLink[Real, paclet:ref/interpreter/Real])  ▪  (RefLink[OrdinalNumber, paclet:ref/interpreter/OrdinalNumber])  ▪  (RefLink[ComplexNumber, paclet:ref/interpreter/ComplexNumber])  ▪  (RefLink[HexInteger, paclet:ref/interpreter/HexInteger])  ▪  (RefLink[RomanNumeral, paclet:ref/interpreter/RomanNumeral])  ▪  (RefLink[SemanticInteger, paclet:ref/interpreter/SemanticInteger])  ▪  (RefLink[ComputedInteger, paclet:ref/interpreter/ComputedInteger])  ▪  (RefLink[SemanticReal, paclet:ref/interpreter/SemanticReal])  ▪  (RefLink[ComputedReal, paclet:ref/interpreter/ComputedReal])  ▪  (RefLink[SemanticComplexNumber, paclet:ref/interpreter/SemanticComplexNumber])  ▪  (RefLink[ComputedComplexNumber, paclet:ref/interpreter/ComputedComplexNumber])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Setting Up Input Interpreters, paclet:guide/InterpretingStrings])}})}})