SpeechInterpreter
Listing of Interpreter Types »SpeechInterpreter[form]
represents an interpreter object that can be applied to a speech input to try to interpret it as an object of the specified form.
SpeechInterpreter[form,test]
returns the interpreted object only if applying test to it yields True; otherwise, it returns a Failure object.
SpeechInterpreter[form,test,fail]
returns the result of applying the function fail if the test fails.
Details and Options
- SpeechInterpreter[…][audio] applies the interpreter to a particular audio recording.
- Possible form specifications include:
-
"SemanticExpression" expression derived semantically from free-form input "SemanticNumber" number derived semantically (e.g. "half") "SemanticInteger" integer derived semantically (e.g. "six") "Boolean" Boolean value (true/false, 1/0, etc. giving True/False) "String" pure string "TextArea" text of any length (rendered in forms as a text area) "TextLine" single line of text "SemanticURL" URL derived semantically (e.g. from company name) "Date" date in any standard format "StructuredDate" date obtained from a picker "DateTime" date and time "Time" time of day "ComputedDate",etc. date derived by computation (e.g. "next tuesday") "Location" anything that yields a geo location "StreetAddress" any standard street address "Country" country or country-like territory "AdministrativeDivision" state, province, county, etc. "USState" US state "USCounty" US county "Quantity" quantity with units "ComputedQuantity" quantity derived by computation "PhysicalQuantity" physical quantity (e.g. "mass") "CurrencyAmount" currency amount (e.g. "$7.50") "CurrencyName" name of a currency (e.g. "US dollars") "Company" company "TickerSymbol" financial instrument ticker symbol "Color" color in any standard format "entity" any Wolfram Language entity type (e.g. "City") "entityclass" a class of entities (e.g. "CityClass") Restricted[form,spec] a form restricted in the specified way DelimitedSequence[form,…] a delimited sequence of forms returned as a list form1form2… several possible forms, tried in order {c1,c2,…} a literal set of choices ci {lab1c1,lab2c2,…} choices ci with labels labi AnySubset[{c1,c2,…}] any subset of the ci CompoundElement[{form1,…}] a list of elements specified by the formi CompoundElement[<key1form1,… >] an association of elements specified by the formi RepeatingElement[form,…] a list of elements all specified by form CloudObject[…] a deployed GrammarRules object QuantityVariable["pq"] a quantity compatible with the physical quantity pq - $InterpreterTypes gives a complete list of possible interpreter types.
- In the case of "entity", any domain supported by EntityValue can be used.
- SpeechInterpreter[…][audio] returns an interpreted value, or Missing["NoInput"] if no speech is recognized from audio.
- SpeechInterpreter[choices] allows a list of rules or an association for choices. A pure list of values can also be used when there is no ambiguity.
- SpeechInterpreter[form,test][input] applies test to the result of interpreting input using the specified form.
- If the result of applying test is True, then the interpretation of input is returned.
- If the result of applying test is a Failure object, this object is immediately returned.
- If the result of applying test is False or anything else, then in SpeechInterpreter[form,test,fail][input] the result of applying fail to the interpretation of input is returned. If no fail is given, then a Failure object is returned.
- If SpeechInterpreter directly generates a Failure object, the following tags are used:
-
"InterpretationFailure" the string given could not be interpreted in the form specified "RestrictionFailure" interpretation succeeded, but a restriction failed "ConditionFailure" interpretation and restrictions succeeded, but explicit test failed "ConnectionFailure" required cloud connection could not be made - SpeechInterpreter supports the following options:
-
AmbiguityFunction Automatic function to apply to ambiguous semantic results GeoLocation $GeoLocation geo location to assume for semantic interpretation Masking All interval of interest TargetDevice "CPU" the device on which to perform recognition TimeZone $TimeZone time zone to assume for semantic interpretation - SpeechInterpreter[spec][{input1,input2,…}] is equivalent to {SpeechInterpreter[spec][input1],SpeechInterpreter[spec][input2],…}, except insofar as spec contains constructs such as CompoundElement or RepeatingElement that directly interpret the structure given.
- SpeechInterpreter[spec][{input1,input2,…}] maps interpretation over all inputi, except insofar as spec contains constructs such as CompoundElement or RepeatingElement that directly interpret the structure given.
- SpeechInterpreter[form][audio1audio2…] yields as a result the interpretation of the first of the audioi that can be interpreted using the specified form.
- SpeechInterpreter uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.
- SpeechInterpreter may download resources that will be stored in your local object store at $LocalBase, and that can be listed using LocalObjects[] and removed using ResourceRemove.
Examples
open allclose allBasic Examples (2)
Scope (19)
Basic Uses (3)
Input Specification (4)
Form Specification (5)
Use a single interpretation type:
Interpretation fails if the recording is not of the specified type:
Use a list of alternative interpretation types. The first interpretation that succeeds is returned:
Return one of a literal set of choices matched by the speech in a recording:
Return the value associated with the literal choice matched by the speech in a recording:
Interpreter Types (7)
Interpret a university, returning an Entity object:
Interpret a location, returning a GeoPosition object:
Interpret input as a currency amount, returning a Quantity object:
Perform a computation on interpreted input:
Interpret many types of entities:
Options (1)
Applications (2)
Properties & Relations (1)
SpeechInterpreter is effectively calling Interpreter on the result of SpeechRecognize:
Text
Wolfram Research (2020), SpeechInterpreter, Wolfram Language function, https://reference.wolfram.com/language/ref/SpeechInterpreter.html.
CMS
Wolfram Language. 2020. "SpeechInterpreter." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SpeechInterpreter.html.
APA
Wolfram Language. (2020). SpeechInterpreter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SpeechInterpreter.html