Development by Davis: “Open brain program aims to improve our working memories” plus 2 more |
- Open brain program aims to improve our working memories
- Creating Your Own Spelling Checker Service
- Khan Academy’s new computer science program is inherently open source
Open brain program aims to improve our working memories Posted: 17 Aug 2012 03:00 AM PDT Brain Workshop is an open brain training program that may help children with attention deficit hyperactive disorder (ADHD) by focusing on learning and memory. It is designed to improve working memory and problem-solving abilities, or fluid intelligence, and to enhance focus and attention. If there is an open alternative method to treating ADHD and improving learning for children with ADHD, the potential gains and impact are profound and far-reaching. If such open brain training could be used in school settings to treat children with ADHD, rather than patented medication, then potential gains and impact are even more profound. |
Creating Your Own Spelling Checker Service Posted: 16 Aug 2012 01:48 PM PDT 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 classTo 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 methodsNext, 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.xmlIn 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 fileLast, 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 sentencesFor 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 samplesIf you'd like to learn more about how to use the spelling checker APIs, take a look at these documents and samples:
Join the discussion on +Android Developers |
Khan Academy’s new computer science program is inherently open source Posted: 16 Aug 2012 04:00 AM PDT As the world demands more and more computer scientists, Khan Academy's computer science program could not have been introduced at a better time. The new curriculum was debuted yesterday in a video featuring John Resig, Khan Academy's Dean of Computer Science, and Sal Khan, Founder of Khan Academy. |
You are subscribed to email updates from Developers by Davis To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No hay comentarios:
Publicar un comentario