Patent Description:
It is increasingly desired to enable interactions with computers to be performed using speech inputs. This requires developments in input processing, in particular how to program computers to process and analyze natural language data. Such processing may involve speech recognition, which is a field of computational linguistics that enables the recognition and translation of spoken language into text by computers. <CIT> discloses methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for language models using domain-specific model components. <CIT> discloses methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for performing dynamic, stroke-based alignment of touch displays. <NPL> discloses an error corrective re-ranking approach that exploits recognition environment characteristics and domain-specific information to provide robustness and adaptability for a spoken language system.

To enable a user to provide inputs to a computing device through speech, a speech input processing system uses context to identify the grammars to apply to candidate transcriptions generated by an automated speech recognizer. Each grammar may indicate a different intent of the speaker or action that the system performs for the same candidate transcription. The system may select a grammar and candidate transcription based on the grammar parsing the candidate transcription, the likelihood that the grammar matches the intent of the user, and the likelihood that the candidate transcription matches what the user said. The system may then perform the action that corresponds to the grammar using the details included in the selected candidate transcription.

In more detail, the speech processing system receives an utterance from a user and generates a word lattice. The word lattice is a data structure that reflects the likely words of the utterance and a confidence score for each word. The system identifies the candidate transcriptions and a transcription confidence score for each candidate transcription from the word lattice. The system identifies the current context that may be based on characteristics of the user, the location of the system, the characteristics of the system, applications running on the system, e.g. a currently active application or an application running in the foreground, or any other similar context data. Based on the context, the system generates a grammar confidence score for the grammars that parse each of the candidate transcriptions. The system adjusts some of the grammar confidence scores in instances where more than one grammar may apply to the same candidate transcription. The system selects a grammar and a candidate transcription based on a combination of the adjusted grammar confidence scores and the transcription confidence scores.

According to an innovative aspect of the subject matter described in this application, a method for processing speech input includes the actions of receiving, by a computing device, audio data of an utterance; generating, by the computing device using (i) a neural network or (ii) an acoustic model and a language model, a word lattice that includes multiple candidate transcriptions of the utterance and that includes transcription confidence scores that each reflect a likelihood that a respective candidate transcription is a match for the utterance; determining, by the computing device, a context of the computing device; based on the context of the computing device, identifying, by the computing device, grammars that correspond to the multiple candidate transcriptions; based on the current context, determining, by the computing device and for each of the multiple candidate transcriptions, grammar confidence scores that reflect a likelihood that a respective grammar is a match for a respective candidate transcription; determining two or more of the grammars correspond to one of the candidate transcriptions; based on determining that two or more of the grammars correspond to one of the candidate transcriptions, adjusting the gramma confidence scores for the two or more grammars by increasing the grammar confidence scores for the two or more grammars; based on the transcription confidence scores and the grammar confidence scores, selecting, by the computing device and from among the candidate transcriptions, a candidate transcription; and providing, for output by the computing device, the selected candidate transcription as a transcription of the utterance. Adjusting the grammar confidence scores for the two or more grammars comprises: increasing each of the grammar confidence scores for each of the two or more grammars by a factor, wherein the product of the factor and the highest grammar confidence score of the grammar confidence scores is <NUM>.

These and other implementations can each optionally include one or more of the following features. The actions include determining, for each of the candidate transcriptions, a product of the respective transcription confidence score and the respective grammar confidence score. The computing device selects, from among the candidate transcriptions, the candidate transcription based on the products of the transcription confidence scores and the respective grammar confidence scores. The action of determining, by the computing device, the context of the computing device is based on a location of the computing device, an application running in a foreground of the computing device, and a time of day. The language model is configured to identify probabilities for sequences of terms included in the word lattice. The acoustic model is configured to identify a phoneme that matches a portion of the audio data. The actions include performing, by the computing device, an action that is based on the selected candidate transcription and a grammar that matches the selected candidate transcription.

Other embodiments of this aspect include corresponding systems, apparatus, and computer programs recorded on computer storage devices, each configured to perform the operations of the methods.

A speech recognition system may use both received speech inputs and a determined context to select the grammars that are used to further process the received speech input to cause a computing device to perform an action. In this way, a speech recognition system may reduce latency in the human-machine interface by applying a limited number of grammars to the candidate transcriptions. The speech recognition system may use a vocabulary that includes all or nearly all words in a language such that the speech recognition system is able to output a transcription when the system receives an unexpected input.

<FIG> illustrates an example system <NUM> that selects a grammar to apply to an utterance based on context. Briefly, and as described in more detail below, the user <NUM> speaks utterance <NUM>. The computing device <NUM> detects the utterance <NUM> and performs an action <NUM> in response to the utterance. The computing device <NUM> may use the context <NUM> of the computing device <NUM> to determine the likely intent of the user <NUM>. Based on the likely intent of the user <NUM>, the computing device <NUM> selects an appropriate action.

In more detail, user <NUM> speaks utterance <NUM> in the vicinity of the computing device <NUM>. The computing device <NUM> may be any type of computing device that is configured to detect audio. For example, the computing device <NUM> may be a mobile phone, a laptop computer, a wearable device, a smart appliance, a desktop computer, a television, or any other type of computing device that is capable of received audio data. The computing device <NUM> processes the audio data of the utterance <NUM> and generates a word lattice <NUM>. The word lattice <NUM> represents the different combinations of words that may correspond to the utterance and a confidence score for each.

As illustrated in <FIG>, the user <NUM> does not speak clearly and says an utterance <NUM> that sounds similar to "flights out. " The computing device <NUM> detects the audio of the user's speech and uses automated speech recognition to determine what the user <NUM> said. The computing device <NUM> applies an acoustic model to the audio data. The acoustic model may be configured to determine the different phonemes that likely correspond to the audio data. For example, the acoustic model may determine that the audio data includes a phoneme for the "f" phoneme, in addition to other phonemes. The computing device <NUM> may apply a language model to the phonemes. The language model may be configured to identify the likely words and series of words that match the phonemes. In some implementations, the computing device <NUM> may transmit the audio data to another computing device, for example, a server. The server may perform speech recognition on the audio data.

The language model generates a word lattice <NUM> that includes different combinations of terms that match the utterance <NUM>. The word lattice includes two words that may be the first word in the utterance <NUM>. The word <NUM> "lights" may be the first word, or the word <NUM> "flights" may be the first word. The language model may compute a confidence score that reflects the likelihood that a word in the word lattice is the word that the user spoke. For example, the language model may determine that the confidence score <NUM> for the word <NUM> "lights" is <NUM>, and the confidence score <NUM> for the word <NUM> "flights" is <NUM>. The word lattice <NUM> includes possible words for the second word. In this example, the language model identified only one possible word <NUM>, "out," for the second word.

In some implementations, the computing device <NUM> may use a sequence-to-sequence neural network, or other type of neural network, in place of the acoustic model and the language model. The neural network may have one or more hidden layers and may be trained using machine learning and training data that includes audio data of sample utterances and transcriptions that correspond to each sample utterance. In this instance, the sequence-to-sequence neural network may generate the word lattice <NUM> and the confidence scores <NUM> and <NUM>. The sequence-to-sequence neural network may not generate separate confidence scores for the phonemes and word combinations as an acoustic model and language model would do. Instead, the sequence-to-sequence neural network may generate confidence scores that are a combination of confidence scores for the phonemes generated by the acoustic model and confidence scores for word combinations generated by a language model.

Based on the word lattice <NUM>, the computing device <NUM> identifies two candidate transcriptions for the utterance <NUM>. The first candidate transcription is "lights out," and the second candidate transcription is "flights out. " The confidence score for the first candidate transcription is <NUM>, and the confidence score for the second candidate transcription is <NUM>. The confidence score for each candidate transcription may be a product of the confidence scores for each of the words in the candidate transcription. The phase "fights out" may be the closest acoustic match to the utterance <NUM>, but based on the language model, the combination of "fight" and "out" is unlikely to occur. Accordingly, "fights out" is not a candidate transcription. In implementations when a neural network is used in place of the acoustic model and the language model, the neural network may not generate separate confidence scores using the acoustic model and the language model.

The computing device <NUM> determines the context <NUM> of the computing device <NUM>. The context <NUM> may be based on any combination of factors that exist on or around the computing device <NUM>. For example, the context <NUM> may include that the computing device <NUM> is located at the home of the user <NUM>. The context <NUM> may include that the current time is <NUM>:00pm and the day of the week is Tuesday. The context <NUM> may include that the computing device <NUM> is a mobile phone that is executing a digital assistant application in the foreground of the computing device <NUM>.

In some implementations, the context <NUM> may include additional information. For example, the context <NUM> may include data related to the orientation of the computing device <NUM> such as being flat on a table or in the user's hand. The context <NUM> may include the applications running in the background. The context may include the data displayed on the computing device's screen or audio outputted by the computing device <NUM> before receiving the utterance <NUM>. For example, the display including the prompt "Hi, how can I help you?" may indicate that the computing device <NUM> is executing a virtual assistant application in the foreground. The context <NUM> may include the weather, the identity of the user <NUM>, demographic data of the user <NUM>, and data stored on or accessible by the computing device <NUM> such as contacts.

The computing device <NUM> uses the context to select a grammar to apply to the transcription. A grammar may be any structure of words that can be described using a common notation technique, for example, Backus-Naur form. Each grammar may correspond to a specific user intent. For example, the user intent may be to issue a home automation command or a media playing command. One example of a grammar may include a grammar for an alarm. The alarm grammar may define a digit as <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, or <NUM> using the notation $DIGIT = (<NUM> | <NUM> | <NUM> | <NUM> | <NUM> | <NUM> | <NUM> | <NUM> | <NUM> | <NUM>). The alarm grammar may define a time using the notation $TIME = $DIGIT $DIGIT : $DIGIT $DIGIT (am | pm) that indicates the time includes two digits, followed by a colon, followed by a two digits, and followed by "am" or "pm. " The alarm grammar may define the mode of the alarm using the notation $MODE = (alarm | timer) that indicates whether the alarm should be in alarm mode or timer mode. Finally, the alarm grammar may define the alarm syntax as $ALARM = set $MODE for $TIME that indicates the user can say "set alarm for <NUM>:<NUM> am" or "set timer for <NUM>:<NUM>. " The computing device <NUM> uses the grammar to parse the spoken command or the typed command and identify an action for the computing device <NUM> to perform. The grammar therefore provides functional data that causes the computing device <NUM> to operate in a particular way in order to parse the command.

Each grammar may be active for certain contexts. For example, the alarm grammar may be active if the application running in the foreground of the computing device <NUM> is an alarm application. The alarm grammar may also be active if the application running in the foreground of the computing device is a digital assistant application. Because the likelihood of a user intending to set the alarm while in an alarm application may be higher than a digital assistant application, the computing device <NUM> may assign a probability of <NUM> to the likelihood of the alarm grammar matching the command and the user's intent if the computing device <NUM> is running the alarm application and a probability of <NUM> if the computing device <NUM> is running a digital assistant application.

In the example illustrated in <FIG>, the computing device <NUM> determines confidence scores for each grammar based on the different candidate transcriptions that may apply to the grammar. In other words, the computing device <NUM> identifies the grammars that parse each of the candidate transcriptions. The applied grammars <NUM> illustrate those grammars that parse the candidate transcription "lights out" and a grammar confidence score that each grammar is the correct grammar for the user's intent. A higher grammar confidence score indicates that the grammar is more likely based on the given transcription and the context. If the transcription is "lights out," then the grammar confidence score <NUM> for the home automation grammar is <NUM>. If the transcription is "lights out," then the grammar confidence score <NUM> for the film commands grammar is <NUM>. If the transcription is "lights out," then the grammar confidence score <NUM> for the music commands grammar is <NUM>. The total of the grammar confidence scores for each transcription should be <NUM>. In that case, the computing device <NUM> may assign the remaining grammar confidence score to a default intent grammar. In this example, if the transcription is "lights out," then the grammar confidence score <NUM> for the default intent grammar is <NUM>. The default intent grammar may not be limited to any particular actions or intent and is able to parse all or nearly all transcriptions.

In some implementations, none of the grammars may be able to parse a particular transcription. In this instance, the default intent grammar applies. For example, there may not be a grammar that parses "flights out. " Because of this, if the transcription is "flights out," then the grammar confidence score for the default intent grammar is <NUM>.

In some implementations, the computing device <NUM> selects a grammar and a transcription based on calculating a product of the transcription confidence scores and the grammar confidence scores. Box <NUM> illustrates the results of selecting a transcription and a grammar based on the product of the transcription confidence scores and the grammar confidence scores. For example, the combined confidence score <NUM> of "lights out" and the home automation grammar is <NUM>. The combined confidence score <NUM> of "lights out" and the film commands grammar is <NUM>. The combined confidence score <NUM> of "lights out" and the music commands grammar is <NUM>. The combined confidence score <NUM> of "lights out" and the default intent grammar is <NUM>. The combined confidence score <NUM> of "flights out" and the default intent grammar is <NUM>. In this implementation, the combined confidence score <NUM> is the highest score. Therefore, using this technique, the computing device <NUM> may perform an action that corresponds to the command "flights out. " This is likely a poor result for the user <NUM> and may result in providing the transcription "flights out" to a search engine.

If searching the internet for "flights out" is not the intent of the user <NUM>, then the user will have to repeat the utterance <NUM>. Doing so will require the computing device <NUM> to expend additional computing and power resources processing an additional utterance. The user <NUM> end up manually inputting the desired command into the computing device <NUM> which would use additional processing and power resources by activating he screen of the computing device <NUM> for an additional period of time.

To decrease the likelihood of the computing device <NUM> performing an action that does not match the user's intent, the computing device <NUM> normalizes the grammar confidence scores of the applied grammars <NUM>. To normalize the grammar confidence scores of the applied grammars <NUM>, the computing device <NUM> computes a factor necessary to increase the highest grammar confidence score to <NUM>. In other words, the product of the factor and the highest grammar confidence score should be <NUM>. The computing device <NUM> then multiplies the other grammar confidence scores by the factor to normalize the other grammar confidence scores. The normalization performed by the computing device <NUM> may be different than traditional probability normalization where probabilities are adjusted to add up to one. Because the highest grammar confidence score is increased to <NUM>, the normalized probabilities do not add up to one. The increased confidence scores may represent pseudo-probabilities instead of probabilities in the traditional sense. The normalization processes described elsewhere in this document may also generate similar pseudo-probabilities.

As illustrated in the normalized grammar confidence scores <NUM>, the computing device <NUM> may identify the grammar confidence score for the home automation grammar as the highest grammar confidence score. To increase the grammar confidence score <NUM> to <NUM>, the computing device multiples the grammar confidence score <NUM> by <NUM>/<NUM> = <NUM>. The computing device <NUM> computes the normalized grammar confidence score <NUM> by multiplying grammar confidence score <NUM> by <NUM>. The computing device <NUM> computes the normalized grammar confidence score <NUM> by multiplying grammar confidence score <NUM> by <NUM>. The computing device <NUM> computes the normalized grammar confidence score <NUM> by multiplying grammar confidence score <NUM> by <NUM>. The grammar confidence score for the default intent grammar if the transcription is "flights out" is <NUM> because there are no other grammars that parse the transcription "flights out. " Therefore, there is no need to normalize the grammar confidence score for the default intent grammar if the transcription is "flights out" because the score is already <NUM>.

Instead of multiplying the grammar confidence scores of box <NUM> by the transcription confidence scores of the word lattice <NUM> as illustrated in box <NUM>, the computing device <NUM> calculates the combined confidence scores using the normalized grammar confidence scores and the transcription confidence scores from the word lattice <NUM>. In particular, the computing device <NUM> multiples each of the normalized grammar confidence scores by the transcription confidence scores for the respective transcription. If there only the default intent grammar applies to a grammar, then the corresponding transcription confidence score remains unchanged because the transcription confidence score is multiplied by <NUM>.

As illustrated in box <NUM>, the computing device <NUM> computes the combined confidence score <NUM> by multiplying the transcription confidence score of "lights out" by the normalized grammar confidence score <NUM> to get a result of <NUM>. The computing device <NUM> computes the combined confidence score <NUM> by multiplying the transcription confidence score of "lights out" by the normalized grammar confidence score <NUM> to get a result of <NUM>. The computing device <NUM> computes the combined confidence score <NUM> by multiplying the transcription confidence score of "lights out" by the normalized grammar confidence score <NUM> to get a result of <NUM>. The computing device <NUM> computes the combined confidence score <NUM> by multiplying the transcription confidence score of "lights out" by the normalized grammar confidence score <NUM> to get a result of <NUM>. The computing device <NUM> maintains the transcription confidence score of "flights out" at <NUM> because there are no grammars that parse the transcription "flights out.

In some implementations, the computing device <NUM> may adjust the confidence scores in box <NUM> to account for grammars that may be more likely given the current user context of the current context of the computing device <NUM>. For example, the user <NUM> may listening to music using computing device <NUM>. Computing device <NUM> may be a media device that plays songs. In this instance, the computing device <NUM> may adjust the confidence score <NUM>. The computing device <NUM> may increase confidence score by multiplying it by a factor, by assigning a preset value to the confidence score, or by another technique. For example, the current probability of a music command is <NUM>, based on the context of the user <NUM> listening to music through the computing device <NUM>, which is a media device. The probability of a music command in box <NUM> may be confidence score <NUM>, which is <NUM>. In this case, the computing device <NUM> may multiply confidence score <NUM> by the ratio of <NUM>/<NUM> = <NUM>. The resulting confidence score <NUM> may be <NUM> * <NUM> = <NUM>. The other confidence scores in box <NUM> may be adjusted with similar ratios for each respective confidence score. For example, the current probability of a home automation command may be <NUM>. In this case, the ratio would be <NUM>/<NUM> = <NUM>, which is <NUM> divided by confidence score <NUM>. The computing device <NUM> may multiple confidence score <NUM> by <NUM> to compute an adjusted, or biased, confidence score of <NUM>. In this case, the highest confidence score ends up being the one that corresponds to the music command.

In some implementations, this extra adjustment step may affect which candidate transcription the computing device <NUM> selects. For example, if the candidate transcription "flights out" were the name of a video game and the user is expected to launch a video game, then the computing device <NUM> may adjust confidence score <NUM> based on a ratio similar to those computed above and using the probability of the user launching a video game to be <NUM>, which is based on the current context of the computing device <NUM> and/or the user <NUM>.

In some implementations, the computing device <NUM> may not use this rescoring step and still improve detection of user intent and speech recognition such as when multiple grammars parse the same candidate transcription. This rescoring step may allow the computing device <NUM> to select different candidate transcriptions that may not be as likely based on the speech recognition confidence scores.

In some implementations, the computing device <NUM> may use this rescoring step without factoring in the confidence scores of box <NUM>. For example, the computing devices may apply the rescoring step to the transcription confidence scores identified from the word lattice <NUM>. In this instance, the computing device <NUM> would not perform the adjustments illustrated in both box <NUM> and box <NUM>.

The computing device <NUM> selects the grammar and transcription with the highest combined confidence score. For example, the home automation transcription and the transcription "lights out" may have the highest combined confidence score of <NUM>. In this case, the computing device <NUM> executes the "lights out" based on the home automation grammar. The computing device <NUM> may turn out the lights in the house where the computing device <NUM> is located or at a home of the user <NUM>. If the computing device <NUM> used the film command grammar, then the computing device <NUM> may play the film "Lights Out. " If the computing device <NUM> used the music command grammar, then the computing device <NUM> may play the song "Lights Out.

As illustrated in <FIG>, the display of the computing device <NUM> may indicate the action performed by the computing device <NUM>. Initially, the computing device <NUM> may display a prompt <NUM> for a digital assistant. The computing device <NUM> receives the utterance <NUM> and indicates by displaying prompt <NUM> that the computing device <NUM> is turning off the lights.

<FIG> illustrates components of an example system <NUM> that selects a grammar to apply to an utterance based on context. The system <NUM> may be any type of computing device that is configured to receive and process speech audio. For example, the system <NUM> may be similar to computing device <NUM> of <FIG>. The components of system <NUM> may be implemented in a single computing device or distributed over multiple computing devices. The system <NUM> being implemented in a single computing device may be beneficial for privacy reasons.

The system <NUM> includes an audio subsystem <NUM>. The audio subsystem <NUM> may include a microphone <NUM>, analog to digital converter <NUM>, buffer <NUM>, and various other audio filters. The microphone <NUM> may be configured to detect sounds in the surrounding area such as speech. The analog to digital converter <NUM> may be configured to sample the audio data detected by the microphone <NUM>. The buffer <NUM> may store the sampled audio data for processing by the system <NUM>. In some implementations, the audio subsystem <NUM> may be continuously active. In this case, the microphone <NUM> may be constantly detecting sound. The analog to digital converter <NUM> may be constantly sampling the detected audio data. The buffer <NUM> may store the latest sampled audio data such as the last ten seconds of sound. If other components of the system <NUM> do not process the audio data in the buffer <NUM>, then the buffer <NUM> may overwrite the previous audio data.

The audio subsystem <NUM> provides the processed audio data to the speech recognizer <NUM>. The speech recognizer provides the audio data as an input to the acoustic model <NUM>. The acoustic model <NUM> may be trained to identify the likely phonemes that corresponds to the sounds in the audio data. For example, if the user says "set," then the acoustic model <NUM> may identify the phonemes that correspond to the "s" sound, the "e" vowel sound, and the "t" sound. The speech recognizer <NUM> provides the identified phonemes as an input to the language model <NUM>. The language model <NUM> generates a word lattice. The word lattice includes term confidence scores for each of the candidate terms identified by the language model <NUM>. For example, the word lattice may indicate that the first term is likely "set. " The language model <NUM> may not identify any other likely terms for the first term. The language model <NUM> may identify two possible terms for the second term. For example, the word lattice may include the terms "time" and "chime" as possible second terms. The language model <NUM> may assign a term confidence score for each term. The term confidence score for "time" may be <NUM>, and the term confidence score for "chime" may be <NUM>.

The speech recognizer <NUM> may generate candidate transcriptions based on the word lattice. Each candidate transcription may have a transcription confidence score the reflects a likelihood that the speaker spoke the terms in the transcription. For example, a candidate transcription may be "set time" and have a transcription confidence score of <NUM>. Another candidate transcription may be "set chime" and have a transcription confidence score of <NUM>.

While the speech recognizer <NUM> is generating the word lattice, the candidate transcriptions, and the transcription confidence scores, the context identifier <NUM> may be collecting context data that indicates the current context of the system <NUM>. The context identifier <NUM> may collect sensor data <NUM> from any sensors of the system. The sensors may include a location sensor, a thermometer, an accelerometer, a gyroscope, a gravity sensor, the time and day, and any other similar sensor. The sensor data <NUM> may also include data related to the status of the system <NUM>. For example, the status may include the battery level of the system <NUM>, the signal strength, any nearby devices that the system <NUM> may be communicating with or aware of, and any other similar state of the system <NUM>.

The context identifier <NUM> may also collect system process data <NUM> that indicates the processes that the system <NUM> is executing. The process data <NUM> may indicate the memory allocated to each process, the processing resources allocated to each process, the applications that the system <NUM> is executing, the applications running in the foreground or background of the system <NUM>, the contents of the interface on the display of the system, and any similar process data.

As an example, the context identifier <NUM> may receive sensor data <NUM> and system process data <NUM> indicating that the system <NUM> is a the user's home, the time is <NUM>:00pm, the day is Monday, the foreground application is a digital assistant application, and the device is a tablet.

The grammar score generator <NUM> receives the context of the system <NUM> from the context identifier <NUM> and the word lattice from the speech recognizer <NUM>. The grammar score generator <NUM> identifies the grammars <NUM> that parse each of the candidate transcriptions of the word lattice. In some instances, none of the grammars <NUM> parse a candidate transcription. In that case, the grammar score generator <NUM> gives the default intent grammar a grammar confidence score of <NUM> to the candidate transcription that is not parable by any of the grammars <NUM>.

In some instances, a single grammar <NUM> may parse a candidate transcription. In that case, the grammar score generator <NUM> may determine a grammar confidence score for the single grammar assuming that the candidate transcription is the actual transcription. Because the grammar confidence score represents a probability, the grammar confidence score is likely less than <NUM>. The grammar score generator <NUM> assigns the difference between <NUM> and the grammar confidence score to a grammar confidence score for the default intent grammar for the candidate transcription.

In some instances, multiple grammars <NUM> may parse a candidate transcription. In that case, the grammar score generator <NUM> may determine grammar confidence scores for each of the grammars assuming that the candidate transcription is the actual transcription. Because the grammar confidence scores represent a collection of probabilities, the sum of the grammar confidence scores is likely less than <NUM>. The grammar score generator <NUM> assigns the difference between <NUM> and the sum of the grammar confidence scores to a grammar confidence score for the default intent grammar for the candidate transcription.

The grammar score normalizer <NUM> receives the grammar confidence scores for each of the candidate transcriptions and normalizes those grammar confidence scores. In some implementations, the grammar score normalizer <NUM> only normalizes the grammar confidence scores for grammars other than the default intent grammar. In the case where the grammar score generator <NUM> generates, for particular candidate transcription, one grammar confidence score for a grammar, the grammar score normalizer <NUM> increases that grammar confidence score to <NUM>. In the case where the grammar score generator <NUM> generates, for a particular candidate transcription, no grammar confidence scores for any grammars, the grammar score normalizer <NUM> maintains the grammar confidence score of the default intent grammar at <NUM>.

In the case where the grammar score generator <NUM> generates, for a particular candidate transcription, multiple grammar confidence scores for each of multiple grammars, the grammar score normalizer <NUM> identifies the highest grammar confidence score for the particular candidate transcription. The grammar score normalizer <NUM> calculates a factor to increase the highest grammar confidence score to <NUM> such that the product of the factor and the highest grammar confidence score is <NUM>. The grammar score normalizer <NUM> increases the other grammar confidence scores for the same particular transcription by multiplying the factor by each of other grammar confidence scores.

The grammar and transcription selector <NUM> receives the normalized grammar confidence scores and the transcription confidence scores. Using both the grammar confidence score and the transcription confidence scores, the grammar and transcription selector <NUM> identifies a grammar and transcription that mostly likely matches the received utterance and the speakers intent by calculating a combined confidence score. The grammar and transcription selector <NUM> determines each combined confidence score by calculating a product of each normalized grammar confidence scores and the transcription confidence score for the corresponding candidate transcription. In the case where the default intent grammar is the only grammar for a particular candidate transcription, the grammar and transcription selector <NUM> maintains the transcription confidence score as the combined confidence score. The grammar and transcription selector <NUM> selects the grammar and the candidate transcription with the highest combined confidence score.

The action identifier <NUM> receives the selected grammar and selected transcription from the grammar and transcription selector <NUM> and identifies an action for the system <NUM> to execute. The selected grammar may indicate the type of action such as setting an alarm, sending a message, playing a song, calling a person, or any other similar action. The selected transcription may indicate the details of the type of action such as how long to set the alarm, whom to send the message to, what song to play, whom to call, or any other similar details for an action. The grammars <NUM> may include information for the type of action for the particular grammar. The grammars <NUM> may include information for how the action identifier <NUM> should parse the candidate transcription to determine the details of the type of action. For example, the grammar may be the $ALARM grammar, and the action identifier <NUM> parses the selected transcription to determine to set a timer for twenty minutes. The action identifier <NUM> may execute the action or provide instructions to another portion of the system <NUM>, for example, a processor.

In some implementations, the user interface generator <NUM> displays an indication of the action or an indication of an execution of the action or both. For example, the user interface generator <NUM> may display the timer counting down from twenty minutes or a confirmation that the lights are turned off in the house. In some instances, the user interface generator <NUM> may not provide any indication of the executed action. For example, the action may be adjusting the thermostat. The system <NUM> may adjust the thermostat without generating a user interface for display on the system <NUM>. In some implementations, the user interface generator <NUM> may generate an interface for the user to interact with or confirm the action. For example, the action may be to call mom. The user interface generator <NUM> may generate a user interface for the user to confirm the action of calling mom before the system <NUM> executes the action.

<FIG> is a flowchart of an example process <NUM> for selecting a grammar based on context. In general, the process <NUM> performs speech recognition on audio and identifies an action to perform based on the transcription of the audio and a grammar that parses the audio. The process <NUM> normalizes grammar confidence scores to identify the action that the speaker likely intended. The process <NUM> will be described as being performed by a computer system comprising one or more computers, for example, the computing device <NUM> of <FIG> or system <NUM> of <FIG>.

The system receives audio data of an utterance (<NUM>). For example, the user may speak an utterance that sound like either "lights out" or "flights out. " The system detects the utterance through a microphone or receives audio data of the utterance. The system may process the audio data using an audio subsystem.

The system generates, using an acoustic model and a language model, a word lattice that includes multiple candidate transcriptions of the utterance and that includes transcription confidence scores that each reflect a likelihood that a respective candidate transcription is a match for the utterance (<NUM>). The system uses automated speech recognition to generate the word lattice. The automated speech recognition process may include providing the audio data as an input to an acoustic model that identifies different phonemes that match each portion of the audio data. The automated speech recognition process may include providing the phonemes as an input to a language model that generates a word lattice that includes confidence scores for each candidate word in the utterance. The language model selects the words for the word lattice from a vocabulary. The vocabulary may include the words of the language that the system is configured to recognize. For example, the system may be configured to English and the vocabulary includes the words of the English language. In some implementations, the actions of the process <NUM> do not include limiting the words in the vocabulary that the system is able to recognize. In other words, the process <NUM> is able to generate a transcription with any of the words in the language that the system is configured to recognize. Because the system is able to recognize each word in the language, the speech recognition process of the system is able to function when the user says something unexpected, as long as it is in the language that the system is configured to recognize.

The system may use the word lattice to generate different candidate transcriptions. Each candidate transcription may include a different transcription confidence score that reflects a likelihood that the user spoke the transcription. For example, the candidate transcription "lights out" may have a confidence score of <NUM> and the candidate transcription "flights out" may have a confidence score of <NUM>.

The system determines a context of the system (<NUM>). In some implementations, the context is based on the location of the system, an application running in the foreground of the computing device, the demographics of the user, data stored on or accessible by the system such as contacts data, previous user queries or commands, the time of day, the date, the day of the week, the weather, the orientation of the system, and any other similar type of information.

The system, based on the context of the system, identifies grammars that correspond to the multiple candidate transcriptions (<NUM>). The grammars may include different structures for different commands that the system is able to execute. For example, the grammars may include a command structure for setting an alarm, playing a movie, performing an internet search, checking the user's calendar, or any other similar action.

The system, based on the current context, determines, for each of the multiple candidate transcriptions, grammar confidence scores that reflect a likelihood that a respective grammar is a match for a respective candidate transcription (<NUM>). The grammar confidence scores may be considered a conditional probability of the likelihood of a grammar matching the intent of the speaker based on the context of the system given one of the candidate transcriptions is the transcription of the utterance. For example, the grammar confidence score of the home automation grammar if the transcription is "lights out" may be <NUM>. In other words, the conditional probability of the home automation grammar given the transcription is "lights out" is <NUM>. The system may generate a grammar confidence score for each of the grammars that parse a candidate transcription. In some implementations because of the context, the system may generate a grammar confidence score only for some of the grammars that parse a candidate transcription. For the sum of the grammar confidence scores for each candidate transcription to add up to <NUM>, the system may assign any remaining probability to a default intent grammar.

The system, based on the transcription confidence scores and the grammar confidence scores, selects, from among the candidate transcriptions, a candidate transcription (<NUM>). In some implementations, the system normalizes the grammar confidence scores by increasing those candidate transcriptions that match more than one grammar. For each candidate transcription, the system may multiply the highest grammar confidence score by a factor necessary to normalize the grammar confidence score to <NUM>. The system may multiple the other grammar confidence scores for the same candidate transcription by the same factor. The system may multiple the normalized grammar confidence scores by the transcription confidence scores to generate combined confidence scores. The system selects the grammar and transcription that has a highest combined confidence score.

The system provides, for output, the selected candidate transcription as a transcription of the utterance (<NUM>). In some implementations, the system performs an action based on the grammar and the candidate transcription. The grammar may indicate an action to take. The action may include playing a movie, calling a contact, turning on the lights, sending a message, or any other similar type of action. The selected transcription may include the contact to call, the message to send, the recipient of the message, the name of the movie, or any other similar details.

In some implementations, the system uses the process of tagging the word lattice for a given set of grammars using a Finite-State Transducer (FST). In some implementations, the system may constrain the grammars as the union of all grammars matching the current context. In some implementations, the system may match the grammars offline in advance or dynamically at runtime.

In some implementations, the process <NUM> may weight the edges of the word lattice. The system may compile the grammars into the weighted finite state transducer that constrains the grammars. The arc weight, or edge weights in this finite state transducer may encode the quantity of the probability of a word for a given grammar, which may be a negative log weight. In some implementations, all of nearly all of the grammars that are relevant to a word lattice may be united together.

The process <NUM> may continue with the system determining the context dependent probability of each grammar, which may be the probability of the grammar given a context. The system may determine the context dependent probability by the supplied component and the corresponding weight, which may aslo be encoded into an arc, or edge, in the grammar constrainer, such as its opening decorator arc.

The process <NUM> may continue with the system clearing the weights of the word lattice. The system may compose the word lattice with the grammar constrainer, which may result in the spans matching grammars to be marked. For example, the spans matching the grammars may be surrounded with opening and closing decorator tags such as <media_commands> play song </media_commands> for the span, or transcription of "play song.

The process <NUM> may continue normalizing the probabilities. The system generates a copy of the tagged lattice with the decorator tags removed. The system determines and minimizes the arc costs in the tropical semiring, which results in each unique word path encoding the highest probability through that word path. The probability may be the probability of a word path given a grammar multiplied by the probability of the grammar. The probabilities may be inverted by flipping the sign of arc weights in negative log weights are used and this inverted lattice may be composed with the tagged lattice. Composing with an inverted lattice may be effectively the same as performing division by that lattice's weights, in this case, by the highest quantity of the probability of a word path given a grammar multiplied by the probability of the grammar, per each word sequence or path. Therefore, the system may divide the optimal tagged paths' probabilities by themselves, and each may become <NUM>. In some implementations, non-optimal paths will receive a lower pseudoprobability, yielding a lattice containing the desired quantity, the pseudoprobability of a grammar for a given word path.

In some implementations, the process <NUM> may include discarding grammars with low conditional probability by using beam pruning. For example, if there are too many grammars that match an utterance "lights out," where the probability of home automation is <NUM>, film commands <NUM>, music commands, <NUM>, generic search <NUM>, online businesses <NUM>, social groups, <NUM>, and online encyclopedia search <NUM>. The system may reduce the processing burden by pruning grammars that are below a threshold or that are below a threshold percentage of the likeliest interpretation, or grammar. For example, the system may prune those grammars that are below a tenth as likely as the likeliest grammar. The system may then remove those grammars that are less than <NUM> for a given transcription. The rationale behind pruning is that low-scoring taggings' probability is so low that no reasonable amount of biasing would result in that interpretation being selected over the more likely interpretations. Pruning may require the system to add a finite state transducer operating to the resulting lattice with the desired pruning weight, which specifies how far behind the best hypotheses a tagging has to be in order to be pruned.

The benefits of the process <NUM> allows the system to bias grammars directly on a lattice. The process <NUM> has a lower complexity than other word lattice tagging algorithms. The process <NUM> solves probability fragmentation caused by tagging ambiguity by implementing max-normalization. The process <NUM> allows discarding relatively improbable proposed taggings by using beam pruning.

In some implementations, process <NUM> may extract the n-best hypotheses out of the lattice, and individually tag every hypothesis and possibility optionally recombining them back into a lattice at the end. The system may assume that the tagger is otherwise identical. Doing so may produce identical results with higher latency and/or lower recall. Recall may be lower if the n-best hypotheses after the top N, such as N=<NUM>, are dropped, which may help to manage latency. Because the number of distinct sentences in a lattice can be exponential relative to the number of words in it, some workarounds can be exponentially slower in worst cases, unless the aforementioned best-N limitation is used, which may limit how many choices are examined.

<FIG> shows an example of a computing device <NUM> and a mobile computing device <NUM> that can be used to implement the techniques described here. The mobile computing device <NUM> is intended to represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart-phones, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to be limiting.

The computing device <NUM> includes a processor <NUM>, a memory <NUM>, a storage device <NUM>, a high-speed interface <NUM> connecting to the memory <NUM> and multiple high-speed expansion ports <NUM>, and a low-speed interface <NUM> connecting to a low-speed expansion port <NUM> and the storage device <NUM>. Each of the processor <NUM>, the memory <NUM>, the storage device <NUM>, the high-speed interface <NUM>, the high-speed expansion ports <NUM>, and the low-speed interface <NUM>, are interconnected using various busses, and may be mounted on a common motherboard or in other manners as appropriate. The processor <NUM> can process instructions for execution within the computing device <NUM>, including instructions stored in the memory <NUM> or on the storage device <NUM> to display graphical information for a GUI on an external input/output device, such as a display <NUM> coupled to the high-speed interface <NUM>. Also, multiple computing devices may be connected, with each device providing portions of the necessary operations (e.g., as a server bank, a group of blade servers, or a multi-processor system).

The high-speed interface <NUM> manages bandwidth-intensive operations for the computing device <NUM>, while the low-speed interface <NUM> manages lower bandwidth-intensive operations. Such allocation of functions is an example only. In some implementations, the high-speed interface <NUM> is coupled to the memory <NUM>, the display <NUM> (e.g., through a graphics processor or accelerator), and to the high-speed expansion ports <NUM>, which may accept various expansion cards (not shown). In the implementation, the low-speed interface <NUM> is coupled to the storage device <NUM> and the low-speed expansion port <NUM>. The low-speed expansion port <NUM>, which may include various communication ports (e.g., USB, Bluetooth, Ethernet, wireless Ethernet) may be coupled to one or more input/output devices, such as a keyboard, a pointing device, a scanner, or a networking device such as a switch or router, e.g., through a network adapter.

The memory <NUM> stores information within the mobile computing device <NUM>. An expansion memory <NUM> may also be provided and connected to the mobile computing device <NUM> through an expansion interface <NUM>, which may include, for example, a SIMM (Single In Line Memory Module) card interface. The expansion memory <NUM> may provide extra storage space for the mobile computing device <NUM>, or may also store applications or other information for the mobile computing device <NUM>. Specifically, the expansion memory <NUM> may include instructions to carry out or supplement the processes described above, and may include secure information also. Thus, for example, the expansion memory <NUM> may be provide as a security module for the mobile computing device <NUM>, and may be programmed with instructions that permit secure use of the mobile computing device <NUM>.

The memory may include, for example, flash memory and/or NVRAM memory (non-volatile random access memory), as discussed below. In some implementations, instructions are stored in an information carrier. that the instructions, when executed by one or more processing devices (for example, processor <NUM>), perform one or more methods, such as those described above. The instructions can also be stored by one or more storage devices, such as one or more computer- or machine-readable mediums (for example, the memory <NUM>, the expansion memory <NUM>, or memory on the processor <NUM>). In some implementations, the instructions can be received in a propagated signal, for example, over the transceiver <NUM> or the external interface <NUM>.

The mobile computing device <NUM> may communicate wirelessly through the communication interface <NUM>, which may include digital signal processing circuitry where necessary. The communication interface <NUM> may provide for communications under various modes or protocols, such as GSM voice calls (Global System for Mobile communications), SMS (Short Message Service), EMS (Enhanced Messaging Service), or MMS messaging (Multimedia Messaging Service), CDMA (code division multiple access), TDMA (time division multiple access), PDC (Personal Digital Cellular), WCDMA (Wideband Code Division Multiple Access), CDMA2000, or GPRS (General Packet Radio Service), among others. Such communication may occur, for example, through the transceiver <NUM> using a radio-frequency. In addition, a GPS (Global Positioning System) receiver module <NUM> may provide additional navigation- and location-related wireless data to the mobile computing device <NUM>, which may be used as appropriate by applications running on the mobile computing device <NUM>.

Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet. In some implementations, the systems and techniques described here can be implemented on an embedded system where speech recognition and other processing is performed directly on the device.

Claim 1:
A computer-implemented method comprising:
receiving, by a computing device, audio data of an utterance;
generating, by the computing device using (i) a neural network or (ii) an acoustic model and a language model, a word lattice that includes multiple candidate transcriptions of the utterance and that includes transcription confidence scores that each reflect a likelihood that a respective candidate transcription is a match for the utterance;
determining, by the computing device, a context of the computing device;
based on the context of the computing device, identifying, by the computing device, grammars that correspond to the multiple candidate transcriptions;
based on the context, determining, by the computing device and for each of the multiple candidate transcriptions, grammar confidence scores that reflect a likelihood that a respective grammar is a match for a respective candidate transcription;
determining that two or more of the grammars correspond to one of the candidate transcriptions;
based on determining that two or more of the grammars correspond to one of the candidate transcriptions, adjusting the grammar confidence scores for the two or more grammars by increasing the grammar confidence scores for the two or more grammars;
based on the transcription confidence scores and the adjusted grammar confidence scores, selecting, by the computing device and from among the candidate transcriptions, a candidate transcription; and
providing, for output by the computing device, the selected candidate transcription as a transcription of the utterance,
wherein adjusting the grammar confidence scores for the two or more grammars comprises:
increasing each of the grammar confidence scores for each of the two or more grammars by a factor, wherein a product of the factor and the highest grammar confidence score of the grammar confidence scores is <NUM>.