Thursday, August 16, 2012

Voice Search arrives in 13 new languages

“Norwegian restaurants in New York City.” I can type that phrase fast, but I can say it even faster—and when I’m on the go, speed is what I’m looking for. With Voice Search, you can speak into your phone to get search results quickly and easily. Voice Search is already available in 29 languages, and today, we're bringing support to 13 new languages for Android users—bringing the total to 42 languages and accents in 46 countries. In fact, 100 million new speakers can use Voice Search now, with the addition of:
  • Basque
  • Bulgarian
  • Catalan
  • European Portuguese
  • Finnish
  • Galician
  • Hungarian
  • Icelandic
  • Norwegian
  • Romanian
  • Serbian
  • Slovak
  • Swedish

Each new language usually requires that we initially collect hundreds of thousands of utterances from volunteers and, although we’ve been working on speech recognition for several years, adding these new languages led our engineers and scientists to tackle some unique challenges. While languages like Romanian follow predictable pronunciation rules, others, like Swedish, required that we recruit native speakers to provide us with the pronunciations for thousands of words. Our scientists then built a machine learning system based on that data to predict how all other Swedish words would be pronounced.

This update has already started to roll out, and will continue to do so over the course of the next week. How you get started with Google Voice Search depends on what kind of phone you have. If your phone runs Android 2.2 or later, and you see the microphone icon on the Google Search widget on your homescreen, all you have to do is tap the icon to start a voice-powered search. Otherwise, you can install the Voice Search app from Google Play. Note that you can only speak one language into the app at a time, and you may need to change your language settings to use one of these new languages.

As with other languages we’ve added, one of the major benefits to Google’s cloud-based model is that the more people use Voice Search, the more accurate it becomes.

Posted by Bertrand Damiba, Product Manager

Creating Your Own Spelling Checker Service

Posted by Satoshi Kataoka and Ken Wakasa of the Android text input engineering team



The Spelling Checker framework improves the text-input experience on Android by helping the user quickly identify and correct spelling errors. When an app uses the spelling checker framework, the user can see a red underline beneath misspelled or unrecognized words so that the user can correct mistakes instantly by choosing a suggestion from a dropdown list.



If you are an input method editor (IME) developer, the Spelling Checker framework gives you a great way to provide an even better experience for your users. You can add your own spelling checker service to your IME to provide consistent spelling error corrections from your own custom dictionary. Your spelling checker can recognize and suggest corrections for the vocabularies that are most important to your users, and if your language is not supported by the built-in spelling checker, you can provide a spelling checker for that language.



The Spelling Checker APIs let you create your own spelling checker service with minimal steps. The framework manages the interaction between your spelling checker service and a text input field. In this post we’ll give you an overview of how to implement a spelling checker service. For details, take a look at the Spelling Checker Framework API Guide.



1. Create a spelling checker service class



To create a spelling checker service, the first step is to create a spelling checker service class that extends android.service.textservice.SpellCheckerService.



For a working example of a spelling checker, you may want to take a look at the SampleSpellCheckerService class in the SpellChecker sample app, available from the Samples download package in the Android SDK.



2. Implement the required methods



Next, in your subclass of SpellCheckerService, implement the methods createSession() and onGetSuggestions(), as shown in the following code snippet:

@Override                                                                        
public Session createSession() {                                             
    return new AndroidSpellCheckerSession();                                 
}       

private static class AndroidSpellCheckerSession extends Session {            
    @Override                                                                
    public SuggestionsInfo onGetSuggestions(TextInfo textInfo, int suggestionsLimit) {
        SuggestionsInfo suggestionsInfo;
        ... // look up suggestions for TextInfo
        return suggestionsInfo;
    }      
}


Note that the input argument textInfo of onGetSuggestions(TextInfo, int) contains a single word. The method returns suggestions for that word as a SuggestionsInfo object. The implementation of this method can access your custom dictionary and any utility classes for extracting and ranking suggestions.



For sentence-level checking, you can also implement onGetSuggestionsMultiple(), which accepts an array of TextInfo.



3. Register the spelling checker service in AndroidManifest.xml



In addition to implementing your subclass, you need to declare the spelling checker service in your manifest file. The declaration specifies the application, the service, and a metadata file that defines the Activity to use for controlling settings. Here’s an example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.samplespellcheckerservice">
    <application android:label="@string/app_name">
        <service 
            android:label="@string/app_name"    
            android:name=".SampleSpellCheckerService" 
            android:permission="android.permission.BIND_TEXT_SERVICE">
            <intent-filter>
                <action 
                    android:name="android.service.textservice.SpellCheckerService" />
            </intent-filter>
            <meta-data
                android:name="android.view.textservice.scs"
                android:resource="@xml/spellchecker" />
        </service>
    </application>
</manifest>


Notice that the service must request the permission android.permission.BIND_TEXT_SERVICE to ensure that only the system binds to the service.



4. Create a metadata XML resource file



Last, create a metadata file for your spelling checker to define the Activity to use for controlling spelling checker settings. The metadata file can also define subtypes for the spelling checker. Place the file in the location specified in the

element of the spelling checker declaration in the manifest file.



In the example below, the metadata file spellchecker.xml specifies the settings Activity as SpellCheckerSettingsActivity and includes subtypes to define the locales that the spelling checker can handle.

<spell-checker xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/spellchecker_name"
    android:settingsactivity="com.example.SpellCheckerSettingsActivity" />
    <subtype   
        android:label="@string/subtype_generic" 
        android:subtypeLocale="en" />
</spell-checker>


That’s it! Your spelling checker service is now available to client applications such as your IME.



Bonus points: Add batch processing of multiple sentences



For faster, more accurate spell-checking, Android 4.1 (Jelly Bean) introduces APIs that let clients pass multiple sentences to your spelling checker at once.



To support sentence-level checking for multiple sentences in a single call, just override and implement the method onGetSentenceSuggestionsMultiple(), as shown below.

private static class AndroidSpellCheckerSession extends Session {                 
    @Override                                                                
    public SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(
          TextInfo[] textInfo, int suggestionsLimit) {
        SentenceSuggestionsInfo[] sentenceSuggestionsInfos;
        ... // look up suggestions for each TextInfo
        return sentenceSuggestionsInfos
    }      
}


In this case, textInfo is an array of TextInfo, each of which holds a sentence. The method returns lengths and offsets of suggestions for each sentence as a SentenceSuggestionsInfo object.



Documents and samples



If you’d like to learn more about how to use the spelling checker APIs, take a look at these documents and samples:

  • Spelling Checker Framework API Guide — a developer guide covering the Spelling Checker API for clients and services.

  • SampleSpellCheckerService sample app — helps you get started with your spelling checker service.

    • You can find the app at /samples/android-15/SpellChecker/SampleSpellCheckerService in the Samples download.

  • HelloSpellChecker sample app — a basic app that uses a spelling checker.

    • You can find the app at /samples/android-15/SpellChecker/HelloSpellChecker in the Samples download.
To learn how to download sample apps for the Android SDK, see Samples.



Wednesday, August 1, 2012

Use any credit or debit card with Google Wallet

(cross-posted from the Google Commerce Blog)

Since we released the first version of Google Wallet, the app that makes your phone your wallet, we’ve made it available on six phones from Sprint and Virgin Mobile, as well as the new Nexus 7 tablet. We’ve also partnered with more than 25 national retailers, and thanks to MasterCard PayPass, you can pay with your phone at more than 200,000 retail locations across the U.S.

Today we’re releasing a new, cloud-based version of the Google Wallet app that supports all credit and debit cards from Visa, MasterCard, American Express, and Discover. Now, you can use any card when you shop in-store or online with Google Wallet. With the new version, you can also remotely disable your mobile wallet app from your Google Wallet account on the web.

 


A wallet with all your credit and debit cards
To save a card to Google Wallet, just enter the number into the mobile app, online wallet, or Google Play when making purchases. When you shop in-store, you can use Google Wallet in conjunction with your selected credit or debit card for purchases (more info here). Shortly after making a payment, you’ll see a transaction record on the phone with the merchant name and dollar amount. You can now view a history of all your in-store and online purchases from the online wallet.





To support all credit and debit cards, we changed our technical approach to storing payment cards. The Google Wallet app now stores your payment cards on highly secure Google servers, instead of in the secure storage area on your phone. A wallet ID (virtual card number) is stored in the secure storage area of the phone, and this is used to facilitate transactions at the point of sale. Google instantly charges your selected credit or debit card. This new approach speeds up the integration process for banks so they can add their cards to the Wallet app in just a few weeks. Banks that want to help their customers save cards to Google Wallet, including their custom card art, can apply here — there is no cost.

A wallet you can lock — and remotely disableWe take security very seriously and have always had a dedicated Google Wallet PIN to prevent others from making payments with your Google Wallet. And as always, we encourage Google Wallet customers to set up the phone’s screen lock -- as an extra layer of protection.

Today, we’re adding a Google Wallet security feature that makes it possible for you to remotely disable your mobile wallet on a lost phone. It’s easy. If you lose your phone, just visit the ‘Devices’ section in the online wallet and select the phone with the mobile wallet you wish to disable. When you successfully disable your wallet on a device, Google Wallet will not authorize any transactions attempted with that device*. If the Google Wallet online service can establish a connection to your device, it will remotely reset your mobile wallet, clearing it of card and transaction data. There is no way you can do that with your leather wallet.


The new Google Wallet app is available now on Google Play, and if you have a supported NFC device and are in the United States, we encourage you to give it a try.

Posted by Robin Dua, Head of Product Management, Google Wallet

* For now, Google Prepaid Cards and some Citi MasterCard cards will remain active until Google Wallet can remotely connect and reset your mobile wallet.