Code cleanup

Change-Id: I7df8c813038adec750eda260740bcc8a4da41acf
main
Ken Wakasa 2011-08-16 17:08:30 +09:00
parent 70b9c5d991
commit f18bda60aa
4 changed files with 3 additions and 162 deletions

View File

@ -20,10 +20,8 @@
<!-- The attributes in this XML file provide configuration information -->
<!-- for the Input Method Manager. -->
<!-- Keyboard: en_US, en_GB, ar, cs, da, de, es, es_US, fi, fr, fr_CA, fr_CH, hr, hu, it, iw, nb, nl, pl, pt, ru, sr, sv, tr -->
<!-- Voice: af, cs, da, de, en, es, fr, it, ja, ko, nl, pl, pt, ru, tr, yue, zh, zu -->
<!-- Keyboard: en_US, en_GB, ar, cs, da, de, de_ZZ, es, es_US, fi, fr, fr_CA, fr_CH, hr, hu, it, iw, nb, nl, pl, pt, ru, sr, sv, tr -->
<!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. -->
<!-- TODO: use <lang>_mic icon instead of a common mic icon. -->
<!-- If IME doesn't have an applicable subtype, the first subtype will be used as a default
subtype.-->
<input-method xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -741,7 +741,8 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
canvas.translate(-x, -y);
}
private static void drawHorizontalLine(Canvas canvas, float y, float w, int color, Paint paint) {
private static void drawHorizontalLine(Canvas canvas, float y, float w, int color,
Paint paint) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(1.0f);
paint.setColor(color);

View File

@ -1,24 +0,0 @@
This text is used as test text for measuring performance of dictionary prediction. Any text can be put into this file to test the performance (total keystroke savings).
When you think about “information,” what probably comes to mind are streams of words and numbers. Googles pretty good at organizing these types of information, but consider all the things you cant express with words: what does it look like in the middle of a sandstorm? What are some great examples of Art Nouveau architecture? Should I consider wedding cupcakes instead of a traditional cake?
This is why we built Google Images in 2001. We realized that for many searches, the best answer wasnt text—it was an image or a set of images. The service has grown quite a bit since then. In 2001, we indexed around 250 million images. By 2005, we had indexed over 1 billion. And today, we have an index of over 10 billion images.
Its not just about quantity, though. Over the past decade weve been baking deep computer science into Google Images to make it even faster and easier for you to find precisely the right images. We not only find images for pretty much anything you type in; we can also instantly pull out images of clip art, line drawings, faces and even colors.
Theres even more sophisticated computer vision technology powering our “Similar images” tool. For example, did you know there are nine subspecies of leopards, each with a distinct pattern of spots? Google Images can recognize the difference, returning just leopards of a particular subspecies. It can tell you the name of the subspecies in a particular image—even if that image isnt labeled—because other similar leopard images on the web are labeled with that subspeciess name.
And our “Similar colors” refinement doesnt just return images based on the overall color of an image. If it did, lots of images would simply be classified as “white.” If youre looking for [tulips] and you refine results to “white,” you really want images in which the tulips themselves are white—not the surrounding image. It takes some heavy-duty algorithmic wizardry and processing power for a search engine to understand what the items of interest are in all the images out there.
Those are just a few of the technologies weve built to make Google Images more useful. Meanwhile, the quantity and variety of images on the web has ballooned since 2001, and images have become one of the most popular types of content people search for. So over the next few days were rolling out an update to Google Images to match the scope and beauty of this fast-growing visual web, and to bring to the surface some of the powerful technology behind Images.
Heres whats new in this refreshed design of Google Images:
Dense tiled layout designed to make it easy to look at lots of images at once. We want to get the app out of the way so you can find what youre really looking for.
Instant scrolling between pages, without letting you get lost in the images. You can now get up to 1,000 images, all in one scrolling page. And well show small, unobtrusive page numbers so you dont lose track of where you are.
Larger thumbnail previews on the results page, designed for modern browsers and high-res screens.
A hover pane that appears when you mouse over a given thumbnail image, giving you a larger preview, more info about the image and other image-specific features such as “Similar images.”
Once you click on an image, youre taken to a new landing page that displays a large image in context, with the website its hosted on visible right behind it. Click anywhere outside the image, and youre right in the original page where you can learn more about the source and context.
Optimized keyboard navigation for faster scrolling through many pages, taking advantage of standard web keyboard shortcuts such as Page Up / Page Down. Its all about getting you to the info you need quickly, so you can get on with actually building that treehouse or buying those flowers.
Apple's not really ready to say it's sorry about the iPhone 4 antenna design, but it is willing to give all you darn squeaky wheels free cases for your trouble. Since Apple can't build its own Bumpers fast enough, it will give you a few options and let you decide, then send it your way for free as long as you purchased the phone before September 30th. Not good enough for you? Well, if you already bought a bumper from Apple you'll get a refund, and you can also return your phone for a full refund within 30 days as long as it's unharmed.
This solution comes at the end of 22 days of Apple engineers "working their butts off," according to Steve, with "physics" ultimately being pinned as the main culprit. Apple claims you can replicate the left-handed "death grip" bar-dropping problem on the BlackBerry Bold 9700, HTC Droid Eris, and Samsung Omnia II, and that "phones aren't perfect." Steve also claims that only 0.55% of people who bought the iPhone 4 have called into AppleCare to complain about the antenna, and the phone has a 1.7% return rate at AT&T, compared to 6% with the 3GS, though he would cop to a slight increase in dropped calls over the iPhone 3GS. For this Steve has what he confesses to be a pet theory: that 3GS users were using the case they had from the 3G, and therefore weren't met with the horrible reality of a naked, call dropping handset. Hence the free case solution, which will probably satisfy some, infuriate others, and never even blip onto the radar of many of the massive horde of consumers that's devoured this product in unprecedented numbers.
Update: Our own Richard Lai just waltzed down to the Regent Street Apple Store in London with his iPhone Bumper receipt in hand. A few minutes later he left with cold, hard cash, and kept the Bumper to boot. Seems as if the refund effort is a go, at least over in the UK.
Update 2: We've heard from several tipsters saying Apple no longer does Bumper refunds at its stores; customers will now have to make an online claim instead. Looks like we got super lucky.
If you have ever received an instant message, text message, or any text-based chat message that seemed to be written in a foreign language, this Webopedia Quick Reference will help you decipher the text chat lingo by providing the definitions to more than 1,300 chat, text message, and Twitter abbreviations.
With the popularity and rise in real-time text-based communications, such as Facebook, Twitter, instant messaging, e-mail, Internet and online gaming services, chat rooms, discussion boards and mobile phone text messaging (SMS), came the emergence of a new language tailored to the immediacy and compactness of these new communication media.
While it does seem incredible that there are so many chat abbreviations, remember that different chat abbreviations are used by different groups of people when communicating online. Some of the following chat abbreviations may be familiar to you, while others may be foreign because they are used by a group of people with different online interests and hobbies than your own. For example, people playing online games are likely to use chat abbreviations that are different than those used by someone running a financial blog updating their Twitter status.
Twitter is a free microblog, or social messaging tool that lets people stay connected through brief text message updates up to 140 characters in length. Twitter is based on you answering the question "What are you doing?" You then post thoughts, observations and goings-on during the day in answer to that question. Your update is posted on your Twitter profile page through SMS text messaging, the Twitter Web site, instant messaging, RSS, e-mail or through other social applications and sites, such as Facebook.
As with any new social medium, there is an entire vocabulary that users of the Twitter service adopt. Many of the new lingo Twitter-based terms and phrases are used to describe the collection of people who use the service, while other terms are used in reference to describe specific functions and features of the service itself. Also, there are a number of "chat terms," which are basically shorthand abbreviations that users often include in their tweets. Lastly, our guide also provides descriptions to a number of Twitter tools and applications that you can use to enhance your Twitter experience.
Here are definitions to more than 100 Twitter-related abbreviations, words, phrases, and tools that are associated with the Twitter microblogging service. If you know of a Twitter slang term or application name that is not included in our Twitter Dictionary, please let us know.

View File

@ -1,134 +0,0 @@
/*
* Copyright (C) 2010,2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.android.inputmethod.latin;
import com.android.inputmethod.latin.tests.R;
import android.content.res.AssetFileDescriptor;
import android.content.res.Configuration;
import android.text.TextUtils;
import android.util.Slog;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Locale;
import java.util.StringTokenizer;
public class SuggestPerformanceTests extends SuggestTestsBase {
private static final String TAG = SuggestPerformanceTests.class.getSimpleName();
private String mTestText;
private SuggestHelper mHelper;
@Override
protected void setUp() throws Exception {
super.setUp();
final AssetFileDescriptor dict = openTestRawResourceFd(R.raw.test);
mHelper = new SuggestHelper(
getContext(), mTestPackageFile, dict.getStartOffset(), dict.getLength(),
createKeyboardId(Locale.US, Configuration.ORIENTATION_PORTRAIT));
loadString(R.raw.testtext);
}
private void loadString(int testFileId) {
final String testFile = getTestContext().getResources().getResourceName(testFileId);
BufferedReader reader = null;
try {
reader = new BufferedReader(
new InputStreamReader(openTestRawResource(testFileId)));
final StringBuilder sb = new StringBuilder();
String line;
Slog.i(TAG, "Reading test file " + testFile);
while ((line = reader.readLine()) != null) {
sb.append(line);
sb.append(" ");
}
mTestText = sb.toString();
} catch (Exception e) {
Slog.e(TAG, "Can not read " + testFile);
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (Exception e) {
Slog.e(TAG, "Closing " + testFile + " failed");
}
}
}
}
/************************** Helper functions ************************/
private int lookForBigramSuggestion(String prevWord, String currentWord) {
for (int i = 1; i < currentWord.length(); i++) {
final CharSequence prefix = currentWord.substring(0, i);
final CharSequence word = (i == 1)
? mHelper.getBigramFirstSuggestion(prevWord, prefix)
: mHelper.getBigramAutoCorrection(prevWord, prefix);
if (TextUtils.equals(word, currentWord))
return i;
}
return currentWord.length();
}
private double runText(boolean withBigrams) {
mHelper.setCorrectionMode(
withBigrams ? Suggest.CORRECTION_FULL_BIGRAM : Suggest.CORRECTION_FULL);
StringTokenizer st = new StringTokenizer(mTestText);
String prevWord = null;
int typeCount = 0;
int characterCount = 0; // without space
int wordCount = 0;
while (st.hasMoreTokens()) {
String currentWord = st.nextToken();
boolean endCheck = false;
if (currentWord.matches("[\\w]*[\\.|?|!|*|@|&|/|:|;]")) {
currentWord = currentWord.substring(0, currentWord.length() - 1);
endCheck = true;
}
if (withBigrams && prevWord != null) {
typeCount += lookForBigramSuggestion(prevWord, currentWord);
} else {
typeCount += lookForBigramSuggestion(null, currentWord);
}
characterCount += currentWord.length();
if (!endCheck) prevWord = currentWord;
wordCount++;
}
double result = (double) (characterCount - typeCount) / characterCount * 100;
if (withBigrams) {
Slog.i(TAG, "with bigrams -> " + result + " % saved!");
} else {
Slog.i(TAG, "without bigrams -> " + result + " % saved!");
}
Slog.i(TAG, "\ttotal number of words: " + wordCount);
Slog.i(TAG, "\ttotal number of characters: " + mTestText.length());
Slog.i(TAG, "\ttotal number of characters without space: " + characterCount);
Slog.i(TAG, "\ttotal number of characters typed: " + typeCount);
return result;
}
/************************** Performance Tests ************************/
/**
* Compare the Suggest with and without bigram
* Check the log for detail
*/
public void testSuggestPerformance() {
assertTrue(runText(false) <= runText(true));
}
}