From 0bddec93817faee9841cb9c00a82912c4b1bc415 Mon Sep 17 00:00:00 2001 From: Klaus Weidner Date: Tue, 20 Nov 2018 00:25:58 -0800 Subject: [PATCH] Remove obsolete Ant build files and tests --- Android.mk | 17 -- CleanSpec.mk | 53 ---- app/src/main/cpp/Android.mk | 20 -- app/src/main/cpp/Application.mk | 1 - java/Android.mk | 22 -- java/MODULE_LICENSE_APACHE2 | 0 java/NOTICE | 190 ------------- java/build.xml | 113 -------- java/proguard.flags | 8 - java/project.properties | 11 - tests/Android.mk | 17 -- tests/AndroidManifest.xml | 33 --- tests/data/bigramlist.xml | 36 --- tests/data/wordlist.xml | 244 ---------------- tests/res/raw/test.dict | Bin 2829 -> 0 bytes tests/res/raw/testtext.txt | 24 -- .../latin/EventRingBufferTests.java | 154 ---------- .../inputmethod/latin/SuggestHelper.java | 268 ------------------ .../latin/SuggestPerformanceTests.java | 126 -------- .../inputmethod/latin/SuggestTests.java | 172 ----------- .../inputmethod/latin/UserBigramTests.java | 100 ------- 21 files changed, 1609 deletions(-) delete mode 100644 Android.mk delete mode 100644 CleanSpec.mk delete mode 100644 app/src/main/cpp/Android.mk delete mode 100644 app/src/main/cpp/Application.mk delete mode 100644 java/Android.mk delete mode 100644 java/MODULE_LICENSE_APACHE2 delete mode 100644 java/NOTICE delete mode 100644 java/build.xml delete mode 100644 java/proguard.flags delete mode 100644 java/project.properties delete mode 100644 tests/Android.mk delete mode 100644 tests/AndroidManifest.xml delete mode 100644 tests/data/bigramlist.xml delete mode 100644 tests/data/wordlist.xml delete mode 100644 tests/res/raw/test.dict delete mode 100644 tests/res/raw/testtext.txt delete mode 100644 tests/src/com/android/inputmethod/latin/EventRingBufferTests.java delete mode 100644 tests/src/com/android/inputmethod/latin/SuggestHelper.java delete mode 100644 tests/src/com/android/inputmethod/latin/SuggestPerformanceTests.java delete mode 100644 tests/src/com/android/inputmethod/latin/SuggestTests.java delete mode 100644 tests/src/com/android/inputmethod/latin/UserBigramTests.java diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 8f1acc55a..000000000 --- a/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2010 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. - -LOCAL_PATH := $(call my-dir) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/CleanSpec.mk b/CleanSpec.mk deleted file mode 100644 index 44ff0a29d..000000000 --- a/CleanSpec.mk +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2007 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. -# - -# If you don't need to do a full clean build but would like to touch -# a file or delete some intermediate files, add a clean step to the end -# of the list. These steps will only be run once, if they haven't been -# run before. -# -# E.g.: -# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) -# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) -# -# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with -# files that are missing or have been moved. -# -# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. -# Use $(OUT_DIR) to refer to the "out" directory. -# -# If you need to re-do something that's already mentioned, just copy -# the command and add it to the bottom of the list. E.g., if a change -# that you made last week required touching a file and a change you -# made today requires touching the same file, just copy the old -# touch step and add it to the end of the list. -# -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ - -# For example: -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) -#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) -#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) - -$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/LatinIME*) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/LatinIME.apk) - -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libjni_latinime_intermediates) -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ diff --git a/app/src/main/cpp/Android.mk b/app/src/main/cpp/Android.mk deleted file mode 100644 index 97136387c..000000000 --- a/app/src/main/cpp/Android.mk +++ /dev/null @@ -1,20 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_C_INCLUDES += $(LOCAL_PATH)/src - -LOCAL_SRC_FILES := \ - jni/org_pocketworkstation_pckeyboard_BinaryDictionary.cpp \ - src/dictionary.cpp \ - src/char_utils.cpp - -#ifneq ($(TARGET_ARCH),x86) -#LOCAL_NDK_VERSION := 4 -#LOCAL_SDK_VERSION := 8 -#endif - -LOCAL_MODULE := libjni_pckeyboard - -LOCAL_MODULE_TAGS := user - -include $(BUILD_SHARED_LIBRARY) diff --git a/app/src/main/cpp/Application.mk b/app/src/main/cpp/Application.mk deleted file mode 100644 index a252a72d7..000000000 --- a/app/src/main/cpp/Application.mk +++ /dev/null @@ -1 +0,0 @@ -APP_ABI := all diff --git a/java/Android.mk b/java/Android.mk deleted file mode 100644 index b9da2755e..000000000 --- a/java/Android.mk +++ /dev/null @@ -1,22 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := PCKeyboard - -LOCAL_CERTIFICATE := shared - -LOCAL_JNI_SHARED_LIBRARIES := libjni_pckeyboard - -LOCAL_STATIC_JAVA_LIBRARIES := android-common - -#LOCAL_AAPT_FLAGS := -0 .dict - -LOCAL_SDK_VERSION := current - -LOCAL_PROGUARD_FLAG_FILES := proguard.flags - -include $(BUILD_PACKAGE) diff --git a/java/MODULE_LICENSE_APACHE2 b/java/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29bb..000000000 diff --git a/java/NOTICE b/java/NOTICE deleted file mode 100644 index 7340b9e35..000000000 --- a/java/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2008, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/java/build.xml b/java/build.xml deleted file mode 100644 index a4e36a2be..000000000 --- a/java/build.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ndk.dir is missing. Dictionary binaries won't be built. - - - - - - - - - - ndk.dir is missing. Dictionary binaries won't be cleaned. - - - - - - - - - - - - - diff --git a/java/proguard.flags b/java/proguard.flags deleted file mode 100644 index 814c8c748..000000000 --- a/java/proguard.flags +++ /dev/null @@ -1,8 +0,0 @@ --keep class org.pocketworkstation.pckeyboard.BinaryDictionary { - int mDictLength; - (...); -} - --keep class org.pocketworkstation.pckeyboard.Suggest { - (...); -} diff --git a/java/project.properties b/java/project.properties deleted file mode 100644 index 2cc58faf4..000000000 --- a/java/project.properties +++ /dev/null @@ -1,11 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-12 diff --git a/tests/Android.mk b/tests/Android.mk deleted file mode 100644 index fba7a8d74..000000000 --- a/tests/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# We only want this apk build for tests. -LOCAL_MODULE_TAGS := tests -LOCAL_CERTIFICATE := shared - -LOCAL_JAVA_LIBRARIES := android.test.runner - -# Include all test java files. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := LatinIMETests - -LOCAL_INSTRUMENTATION_FOR := LatinIME - -include $(BUILD_PACKAGE) diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml deleted file mode 100644 index 210e81489..000000000 --- a/tests/AndroidManifest.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/data/bigramlist.xml b/tests/data/bigramlist.xml deleted file mode 100644 index dd3f2916e..000000000 --- a/tests/data/bigramlist.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/data/wordlist.xml b/tests/data/wordlist.xml deleted file mode 100644 index b870eb2a3..000000000 --- a/tests/data/wordlist.xml +++ /dev/null @@ -1,244 +0,0 @@ - - the - and - of - to - in - that - for - with - on - it - this - you - is - was - by - or - from - but - be - Sunday - are - he - so - not - have - as - all - his - my - if - which - they - at - it's - an - your - will - about - I'm - there - had - has - when - no - were - what - more - out - just - their - up - would - here - can - who - her - me - now - our - do - some - been - two - like - them - new - time - we - she - one - over - may - any - him - calling - other - how - see - because - then - right - into - well - very - said - people - these - than - only - back - first - dot - after - where - please - could - its - before - us - again - home - also - that's - think - three - good - get - know - thank - should - going - down - last - today - those - go - through - such - don't - did - most - day - man - number - work - too - show - made - even - being - make - give - off - com - much - great - take - call - way - four - say - information - under - page - many - little - thanks - okay - five - we're - between - use - come - years - office - house - search - free - next - without - still - around - I've - business - part - every - bye - upon - you're - state - life - year - thing - since - things - something - long - got - while - I'll - help - service - really - must - does - name - both - six - want - same - each - yet - let - view - place - another - company - talk - might - am - though - find - details - look - world - old - called - case - system - news - used - contact - never - seven - city - until - during - set - why - point - twenty - high - love - services - niño - María - car - hmmm - hon - tty - ttyl - txt - ur - wah - whatcha - woah - ya - yea - yeh - yessir - yikes - yrs - diff --git a/tests/res/raw/test.dict b/tests/res/raw/test.dict deleted file mode 100644 index 6a5d6d794f4a1f5c21f25ff97bfd89fe5a0f80f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2829 zcmXYzdyG}p6~^~I?{iR^*d}UQYeO|tt3_<9Z7rk=+hQvv(o{*51R3U@nYr9M_mcaV zVVcmM65CWv)%b{kno?5Q6q;Jw;W@+O$U_DY5D1Tok5NI?f(nX_)IfjhPX9SMd+)Wr zwZ65!z0Mi7pKXXKwTpeMD$ciy;tX_(dr6JW0lONzzx6WLql9!D*6w9CnLYRL$+J zXHB2jX+^OqVXF#?4oHGv$H7XR86d36+15I&kmTHm_ar-_hdUvCEIH1 zVz${d+hc4k+hus$Vw^^94!>zCxf$7FY@3*4ww`S^wv?Nbn+)&kjZ@EFH5D=EoDwHp zxixF_V2yE7v11ALX^?PfioL>iiM`5pXB+Vndp%ndINWG-|7P}A8>b-ld(~{nSXlhf z_N!@?{J@%FD`IC_n9XK?z}OzKb8&ypI3=<3%VHO>8YDSzY=3SaFvgZM9t|FGCAWk7 z;B1f8vqJ{!4;tBiGe;cTDbDA*#Q91Oer_TA$n=Q8huBJ*zaG z8!ZC)hOK0|i8^y<);a3!G)7D z9a_!;it{Xu%XR}WOdG{{gizZJM4TnMT*`7=EAk3#*BkO*WjtaIpEQl!xiDhtMD9c( z4q^9Gp2LvZ+9Gw#*2Ed1^v(%Q{T-$Ao@Vl)QvMhcD56c=unrq!u+O+vaj&e2+g22J zl2gl0z{wp)3WIc3+zF|;-?BZ~i&?Ot*&^a%d`GXicU8o_$JWKYlNwT~bTrk~#s{g{ zF7D!PasQs??th=7A>QXn*8O=|+{bNq?*3{-({&fo1NUM4*Qylu8c&(^6B_K5-J{wV z1>{1xM*uxh&30ljV4Mzd_W*YQT^`WrYm8ILo<~9M2rCk5igz8WueXag*A|8n8t8Zy_u=M_UC_ZdQz6nGxMYmL{Qd%rQJfk@T6F5cs|mU|CFy^cPpq_>z( zdB3OjT#Ax-e?bl2-#BHd55GV6UQo?>htk|Tf0VJ|-(3~|z7{@``j?`H~&i86#ol2_+J9Dr6~WaFz~;| z61`N!pJ==E_V zCGa#^6!8+a*}hlpt?Nu&XG+$$kmW zV;o##(>%DI`^musAw9fzsbS|5yn@CBR>Q3~d5Lql~*_$uuRkF%suZ4$og_Aug|O9~`^p)8S$Z)@CO z&6oUAN)la$^={+M%cC21nR*`Gk~4v#+gcZ~D$z|eL+R$xBpO$MFyFywYD1#C;Tuhd zFJrnW(Y0Kf{&7-{Slvl8PQhQhWh)(39ON z9YWDFJ$W>!lQ23!bEDOq=Bm1NW}ZY_Eis1Gbq_^>D7hTby_YP1Ca*zFM0=llY2?#8jD)Dl#bGIb%FG2Wqr^HV{l8M9WK}C6l zCG~5yr7rQ(R&W=nf8e}^KdT`i$)q$|9%Tk)3K;JN`DJ<@AEf8;QTDkZM15UhPwL|o zsq1Bx_o$B+NgZi5-$m=Z$>$^_x|bq=OY~S{Hc50@3A+gCg*uBKzdusL?U&0~2 fgvmQlMY!bnp>54$EH2oZjB)L0858kETxtFXLKju= diff --git a/tests/res/raw/testtext.txt b/tests/res/raw/testtext.txt deleted file mode 100644 index eca20c05f..000000000 --- a/tests/res/raw/testtext.txt +++ /dev/null @@ -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. Google’s pretty good at organizing these types of information, but consider all the things you can’t 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 wasn’t 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. -It’s not just about quantity, though. Over the past decade we’ve 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. -There’s 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 isn’t labeled—because other similar leopard images on the web are labeled with that subspecies’s name. -And our “Similar colors” refinement doesn’t just return images based on the overall color of an image. If it did, lots of images would simply be classified as “white.” If you’re 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 we’ve 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 we’re 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. -Here’s what’s 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 you’re 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 we’ll show small, unobtrusive page numbers so you don’t 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, you’re taken to a new landing page that displays a large image in context, with the website it’s hosted on visible right behind it. Click anywhere outside the image, and you’re 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. It’s 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. diff --git a/tests/src/com/android/inputmethod/latin/EventRingBufferTests.java b/tests/src/com/android/inputmethod/latin/EventRingBufferTests.java deleted file mode 100644 index 620f036db..000000000 --- a/tests/src/com/android/inputmethod/latin/EventRingBufferTests.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. - * - * 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.SwipeTracker.EventRingBuffer; - -import android.test.AndroidTestCase; - -public class EventRingBufferTests extends AndroidTestCase { - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - private static float X_BASE = 1000f; - - private static float Y_BASE = 2000f; - - private static long TIME_BASE = 3000l; - - private static float x(int id) { - return X_BASE + id; - } - - private static float y(int id) { - return Y_BASE + id; - } - - private static long time(int id) { - return TIME_BASE + id; - } - - private static void addEvent(EventRingBuffer buf, int id) { - buf.add(x(id), y(id), time(id)); - } - - private static void assertEventSize(EventRingBuffer buf, int size) { - assertEquals(size, buf.size()); - } - - private static void assertEvent(EventRingBuffer buf, int pos, int id) { - assertEquals(x(id), buf.getX(pos), 0f); - assertEquals(y(id), buf.getY(pos), 0f); - assertEquals(time(id), buf.getTime(pos)); - } - - public void testClearBuffer() { - EventRingBuffer buf = new EventRingBuffer(4); - assertEventSize(buf, 0); - - addEvent(buf, 0); - addEvent(buf, 1); - addEvent(buf, 2); - addEvent(buf, 3); - addEvent(buf, 4); - assertEventSize(buf, 4); - - buf.clear(); - assertEventSize(buf, 0); - } - - public void testRingBuffer() { - EventRingBuffer buf = new EventRingBuffer(4); - assertEventSize(buf, 0); // [0] - - addEvent(buf, 0); - assertEventSize(buf, 1); // [1] 0 - assertEvent(buf, 0, 0); - - addEvent(buf, 1); - addEvent(buf, 2); - assertEventSize(buf, 3); // [3] 2 1 0 - assertEvent(buf, 0, 0); - assertEvent(buf, 1, 1); - assertEvent(buf, 2, 2); - - addEvent(buf, 3); - assertEventSize(buf, 4); // [4] 3 2 1 0 - assertEvent(buf, 0, 0); - assertEvent(buf, 1, 1); - assertEvent(buf, 2, 2); - assertEvent(buf, 3, 3); - - addEvent(buf, 4); - addEvent(buf, 5); - assertEventSize(buf, 4); // [4] 5 4|3 2(1 0) - assertEvent(buf, 0, 2); - assertEvent(buf, 1, 3); - assertEvent(buf, 2, 4); - assertEvent(buf, 3, 5); - - addEvent(buf, 6); - addEvent(buf, 7); - addEvent(buf, 8); - assertEventSize(buf, 4); // [4] 8 7 6 5|(4 3 2)1|0 - assertEvent(buf, 0, 5); - assertEvent(buf, 1, 6); - assertEvent(buf, 2, 7); - assertEvent(buf, 3, 8); - } - - public void testDropOldest() { - EventRingBuffer buf = new EventRingBuffer(4); - - addEvent(buf, 0); - assertEventSize(buf, 1); // [1] 0 - assertEvent(buf, 0, 0); - - buf.dropOldest(); - assertEventSize(buf, 0); // [0] (0) - - addEvent(buf, 1); - addEvent(buf, 2); - addEvent(buf, 3); - addEvent(buf, 4); - assertEventSize(buf, 4); // [4] 4|3 2 1(0) - assertEvent(buf, 0, 1); - - buf.dropOldest(); - assertEventSize(buf, 3); // [3] 4|3 2(1)0 - assertEvent(buf, 0, 2); - - buf.dropOldest(); - assertEventSize(buf, 2); // [2] 4|3(2)10 - assertEvent(buf, 0, 3); - - buf.dropOldest(); - assertEventSize(buf, 1); // [1] 4|(3)210 - assertEvent(buf, 0, 4); - - buf.dropOldest(); - assertEventSize(buf, 0); // [0] (4)|3210 - } -} diff --git a/tests/src/com/android/inputmethod/latin/SuggestHelper.java b/tests/src/com/android/inputmethod/latin/SuggestHelper.java deleted file mode 100644 index 759bfa18a..000000000 --- a/tests/src/com/android/inputmethod/latin/SuggestHelper.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2010 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 android.content.Context; -import android.text.TextUtils; -import android.util.Log; -import com.android.inputmethod.latin.Suggest; -import com.android.inputmethod.latin.UserBigramDictionary; -import com.android.inputmethod.latin.WordComposer; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.channels.Channels; -import java.util.List; -import java.util.Locale; -import java.util.StringTokenizer; - -public class SuggestHelper { - private Suggest mSuggest; - private UserBigramDictionary mUserBigram; - private final String TAG; - - /** Uses main dictionary only **/ - public SuggestHelper(String tag, Context context, int[] resId) { - TAG = tag; - InputStream[] is = null; - try { - // merging separated dictionary into one if dictionary is separated - int total = 0; - is = new InputStream[resId.length]; - for (int i = 0; i < resId.length; i++) { - is[i] = context.getResources().openRawResource(resId[i]); - total += is[i].available(); - } - - ByteBuffer byteBuffer = - ByteBuffer.allocateDirect(total).order(ByteOrder.nativeOrder()); - int got = 0; - for (int i = 0; i < resId.length; i++) { - got += Channels.newChannel(is[i]).read(byteBuffer); - } - if (got != total) { - Log.w(TAG, "Read " + got + " bytes, expected " + total); - } else { - mSuggest = new Suggest(context, byteBuffer); - Log.i(TAG, "Created mSuggest " + total + " bytes"); - } - } catch (IOException e) { - Log.w(TAG, "No available memory for binary dictionary"); - } finally { - try { - if (is != null) { - for (int i = 0; i < is.length; i++) { - is[i].close(); - } - } - } catch (IOException e) { - Log.w(TAG, "Failed to close input stream"); - } - } - mSuggest.setAutoTextEnabled(false); - mSuggest.setCorrectionMode(Suggest.CORRECTION_FULL_BIGRAM); - } - - /** Uses both main dictionary and user-bigram dictionary **/ - public SuggestHelper(String tag, Context context, int[] resId, int userBigramMax, - int userBigramDelete) { - this(tag, context, resId); - mUserBigram = new UserBigramDictionary(context, null, Locale.US.toString(), - Suggest.DIC_USER); - mUserBigram.setDatabaseMax(userBigramMax); - mUserBigram.setDatabaseDelete(userBigramDelete); - mSuggest.setUserBigramDictionary(mUserBigram); - } - - void changeUserBigramLocale(Context context, Locale locale) { - if (mUserBigram != null) { - flushUserBigrams(); - mUserBigram.close(); - mUserBigram = new UserBigramDictionary(context, null, locale.toString(), - Suggest.DIC_USER); - mSuggest.setUserBigramDictionary(mUserBigram); - } - } - - private WordComposer createWordComposer(CharSequence s) { - WordComposer word = new WordComposer(); - for (int i = 0; i < s.length(); i++) { - final char c = s.charAt(i); - int[] codes; - // If it's not a lowercase letter, don't find adjacent letters - if (c < 'a' || c > 'z') { - codes = new int[] { c }; - } else { - codes = adjacents[c - 'a']; - } - word.add(c, codes); - } - return word; - } - - private void showList(String title, List suggestions) { - Log.i(TAG, title); - for (int i = 0; i < suggestions.size(); i++) { - Log.i(title, suggestions.get(i) + ", "); - } - } - - private boolean isDefaultSuggestion(List suggestions, CharSequence word) { - // Check if either the word is what you typed or the first alternative - return suggestions.size() > 0 && - (/*TextUtils.equals(suggestions.get(0), word) || */ - (suggestions.size() > 1 && TextUtils.equals(suggestions.get(1), word))); - } - - boolean isDefaultSuggestion(CharSequence typed, CharSequence expected) { - WordComposer word = createWordComposer(typed); - List suggestions = mSuggest.getSuggestions(null, word, false, null); - return isDefaultSuggestion(suggestions, expected); - } - - boolean isDefaultCorrection(CharSequence typed, CharSequence expected) { - WordComposer word = createWordComposer(typed); - List suggestions = mSuggest.getSuggestions(null, word, false, null); - return isDefaultSuggestion(suggestions, expected) && mSuggest.hasMinimalCorrection(); - } - - boolean isASuggestion(CharSequence typed, CharSequence expected) { - WordComposer word = createWordComposer(typed); - List suggestions = mSuggest.getSuggestions(null, word, false, null); - for (int i = 1; i < suggestions.size(); i++) { - if (TextUtils.equals(suggestions.get(i), expected)) return true; - } - return false; - } - - private void getBigramSuggestions(CharSequence previous, CharSequence typed) { - if (!TextUtils.isEmpty(previous) && (typed.length() > 1)) { - WordComposer firstChar = createWordComposer(Character.toString(typed.charAt(0))); - mSuggest.getSuggestions(null, firstChar, false, previous); - } - } - - boolean isDefaultNextSuggestion(CharSequence previous, CharSequence typed, - CharSequence expected) { - WordComposer word = createWordComposer(typed); - getBigramSuggestions(previous, typed); - List suggestions = mSuggest.getSuggestions(null, word, false, previous); - return isDefaultSuggestion(suggestions, expected); - } - - boolean isDefaultNextCorrection(CharSequence previous, CharSequence typed, - CharSequence expected) { - WordComposer word = createWordComposer(typed); - getBigramSuggestions(previous, typed); - List suggestions = mSuggest.getSuggestions(null, word, false, previous); - return isDefaultSuggestion(suggestions, expected) && mSuggest.hasMinimalCorrection(); - } - - boolean isASuggestion(CharSequence previous, CharSequence typed, - CharSequence expected) { - WordComposer word = createWordComposer(typed); - getBigramSuggestions(previous, typed); - List suggestions = mSuggest.getSuggestions(null, word, false, previous); - for (int i = 1; i < suggestions.size(); i++) { - if (TextUtils.equals(suggestions.get(i), expected)) return true; - } - return false; - } - - boolean isValid(CharSequence typed) { - return mSuggest.isValidWord(typed); - } - - boolean isUserBigramSuggestion(CharSequence previous, char typed, - CharSequence expected) { - WordComposer word = createWordComposer(Character.toString(typed)); - - if (mUserBigram == null) return false; - - flushUserBigrams(); - if (!TextUtils.isEmpty(previous) && !TextUtils.isEmpty(Character.toString(typed))) { - WordComposer firstChar = createWordComposer(Character.toString(typed)); - mSuggest.getSuggestions(null, firstChar, false, previous); - boolean reloading = mUserBigram.reloadDictionaryIfRequired(); - if (reloading) mUserBigram.waitForDictionaryLoading(); - mUserBigram.getBigrams(firstChar, previous, mSuggest, null); - } - - List suggestions = mSuggest.mBigramSuggestions; - for (int i = 0; i < suggestions.size(); i++) { - if (TextUtils.equals(suggestions.get(i), expected)) return true; - } - - return false; - } - - void addToUserBigram(String sentence) { - StringTokenizer st = new StringTokenizer(sentence); - String previous = null; - while (st.hasMoreTokens()) { - String current = st.nextToken(); - if (previous != null) { - addToUserBigram(new String[] {previous, current}); - } - previous = current; - } - } - - void addToUserBigram(String[] pair) { - if (mUserBigram != null && pair.length == 2) { - mUserBigram.addBigrams(pair[0], pair[1]); - } - } - - void flushUserBigrams() { - if (mUserBigram != null) { - mUserBigram.flushPendingWrites(); - mUserBigram.waitUntilUpdateDBDone(); - } - } - - final int[][] adjacents = { - {'a','s','w','q',-1}, - {'b','h','v','n','g','j',-1}, - {'c','v','f','x','g',}, - {'d','f','r','e','s','x',-1}, - {'e','w','r','s','d',-1}, - {'f','g','d','c','t','r',-1}, - {'g','h','f','y','t','v',-1}, - {'h','j','u','g','b','y',-1}, - {'i','o','u','k',-1}, - {'j','k','i','h','u','n',-1}, - {'k','l','o','j','i','m',-1}, - {'l','k','o','p',-1}, - {'m','k','n','l',-1}, - {'n','m','j','k','b',-1}, - {'o','p','i','l',-1}, - {'p','o',-1}, - {'q','w',-1}, - {'r','t','e','f',-1}, - {'s','d','e','w','a','z',-1}, - {'t','y','r',-1}, - {'u','y','i','h','j',-1}, - {'v','b','g','c','h',-1}, - {'w','e','q',-1}, - {'x','c','d','z','f',-1}, - {'y','u','t','h','g',-1}, - {'z','s','x','a','d',-1}, - }; -} diff --git a/tests/src/com/android/inputmethod/latin/SuggestPerformanceTests.java b/tests/src/com/android/inputmethod/latin/SuggestPerformanceTests.java deleted file mode 100644 index 7eb66d502..000000000 --- a/tests/src/com/android/inputmethod/latin/SuggestPerformanceTests.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2010 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 android.test.AndroidTestCase; -import android.util.Log; -import com.android.inputmethod.latin.tests.R; -import java.io.InputStreamReader; -import java.io.InputStream; -import java.io.BufferedReader; -import java.util.StringTokenizer; - -public class SuggestPerformanceTests extends AndroidTestCase { - private static final String TAG = "SuggestPerformanceTests"; - - private String mTestText; - private SuggestHelper sh; - - @Override - protected void setUp() { - // TODO Figure out a way to directly using the dictionary rather than copying it over - - // For testing with real dictionary, TEMPORARILY COPY main dictionary into test directory. - // DO NOT SUBMIT real dictionary under test directory. - //int[] resId = new int[] { R.raw.main0, R.raw.main1, R.raw.main2 }; - - int[] resId = new int[] { R.raw.test }; - - sh = new SuggestHelper(TAG, getTestContext(), resId); - loadString(); - } - - private void loadString() { - try { - InputStream is = getTestContext().getResources().openRawResource(R.raw.testtext); - BufferedReader reader = new BufferedReader(new InputStreamReader(is)); - StringBuilder sb = new StringBuilder(); - String line = reader.readLine(); - while (line != null) { - sb.append(line + " "); - line = reader.readLine(); - } - mTestText = sb.toString(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /************************** Helper functions ************************/ - private int lookForSuggestion(String prevWord, String currentWord) { - for (int i = 1; i < currentWord.length(); i++) { - if (i == 1) { - if (sh.isDefaultNextSuggestion(prevWord, currentWord.substring(0, i), - currentWord)) { - return i; - } - } else { - if (sh.isDefaultNextCorrection(prevWord, currentWord.substring(0, i), - currentWord)) { - return i; - } - } - } - return currentWord.length(); - } - - private double runText(boolean withBigrams) { - 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 += lookForSuggestion(prevWord, currentWord); - } else { - typeCount += lookForSuggestion(null, currentWord); - } - characterCount += currentWord.length(); - if (!endCheck) prevWord = currentWord; - wordCount++; - } - - double result = (double) (characterCount - typeCount) / characterCount * 100; - if (withBigrams) { - Log.i(TAG, "with bigrams -> " + result + " % saved!"); - } else { - Log.i(TAG, "without bigrams -> " + result + " % saved!"); - } - Log.i(TAG, "\ttotal number of words: " + wordCount); - Log.i(TAG, "\ttotal number of characters: " + mTestText.length()); - Log.i(TAG, "\ttotal number of characters without space: " + characterCount); - Log.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)); - } -} diff --git a/tests/src/com/android/inputmethod/latin/SuggestTests.java b/tests/src/com/android/inputmethod/latin/SuggestTests.java deleted file mode 100644 index 8463ed316..000000000 --- a/tests/src/com/android/inputmethod/latin/SuggestTests.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2010 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 android.test.AndroidTestCase; -import com.android.inputmethod.latin.tests.R; - -public class SuggestTests extends AndroidTestCase { - private static final String TAG = "SuggestTests"; - - private SuggestHelper sh; - - @Override - protected void setUp() { - int[] resId = new int[] { R.raw.test }; - sh = new SuggestHelper(TAG, getTestContext(), resId); - } - - /************************** Tests ************************/ - - /** - * Tests for simple completions of one character. - */ - public void testCompletion1char() { - assertTrue(sh.isDefaultSuggestion("peopl", "people")); - assertTrue(sh.isDefaultSuggestion("abou", "about")); - assertTrue(sh.isDefaultSuggestion("thei", "their")); - } - - /** - * Tests for simple completions of two characters. - */ - public void testCompletion2char() { - assertTrue(sh.isDefaultSuggestion("peop", "people")); - assertTrue(sh.isDefaultSuggestion("calli", "calling")); - assertTrue(sh.isDefaultSuggestion("busine", "business")); - } - - /** - * Tests for proximity errors. - */ - public void testProximityPositive() { - assertTrue(sh.isDefaultSuggestion("peiple", "people")); - assertTrue(sh.isDefaultSuggestion("peoole", "people")); - assertTrue(sh.isDefaultSuggestion("pwpple", "people")); - } - - /** - * Tests for proximity errors - negative, when the error key is not near. - */ - public void testProximityNegative() { - assertFalse(sh.isDefaultSuggestion("arout", "about")); - assertFalse(sh.isDefaultSuggestion("ire", "are")); - } - - /** - * Tests for checking if apostrophes are added automatically. - */ - public void testApostropheInsertion() { - assertTrue(sh.isDefaultSuggestion("im", "I'm")); - assertTrue(sh.isDefaultSuggestion("dont", "don't")); - } - - /** - * Test to make sure apostrophed word is not suggested for an apostrophed word. - */ - public void testApostrophe() { - assertFalse(sh.isDefaultSuggestion("don't", "don't")); - } - - /** - * Tests for suggestion of capitalized version of a word. - */ - public void testCapitalization() { - assertTrue(sh.isDefaultSuggestion("i'm", "I'm")); - assertTrue(sh.isDefaultSuggestion("sunday", "Sunday")); - assertTrue(sh.isDefaultSuggestion("sundat", "Sunday")); - } - - /** - * Tests to see if more than one completion is provided for certain prefixes. - */ - public void testMultipleCompletions() { - assertTrue(sh.isASuggestion("com", "come")); - assertTrue(sh.isASuggestion("com", "company")); - assertTrue(sh.isASuggestion("th", "the")); - assertTrue(sh.isASuggestion("th", "that")); - assertTrue(sh.isASuggestion("th", "this")); - assertTrue(sh.isASuggestion("th", "they")); - } - - /** - * Does the suggestion engine recognize zero frequency words as valid words. - */ - public void testZeroFrequencyAccepted() { - assertTrue(sh.isValid("yikes")); - assertFalse(sh.isValid("yike")); - } - - /** - * Tests to make sure that zero frequency words are not suggested as completions. - */ - public void testZeroFrequencySuggestionsNegative() { - assertFalse(sh.isASuggestion("yike", "yikes")); - assertFalse(sh.isASuggestion("what", "whatcha")); - } - - /** - * Tests to ensure that words with large edit distances are not suggested, in some cases - * and not considered corrections, in some cases. - */ - public void testTooLargeEditDistance() { - assertFalse(sh.isASuggestion("sniyr", "about")); - assertFalse(sh.isDefaultCorrection("rjw", "the")); - } - - /** - * Make sure sh.isValid is case-sensitive. - */ - public void testValidityCaseSensitivity() { - assertTrue(sh.isValid("Sunday")); - assertFalse(sh.isValid("sunday")); - } - - /** - * Are accented forms of words suggested as corrections? - */ - public void testAccents() { - // nio - assertTrue(sh.isDefaultCorrection("nino", "ni\u00F1o")); - // nio - assertTrue(sh.isDefaultCorrection("nimo", "ni\u00F1o")); - // Mara - assertTrue(sh.isDefaultCorrection("maria", "Mar\u00EDa")); - } - - /** - * Make sure bigrams are showing when first character is typed - * and don't show any when there aren't any - */ - public void testBigramsAtFirstChar() { - assertTrue(sh.isDefaultNextSuggestion("about", "p", "part")); - assertTrue(sh.isDefaultNextSuggestion("I'm", "a", "about")); - assertTrue(sh.isDefaultNextSuggestion("about", "b", "business")); - assertTrue(sh.isASuggestion("about", "b", "being")); - assertFalse(sh.isDefaultNextSuggestion("about", "p", "business")); - } - - /** - * Make sure bigrams score affects the original score - */ - public void testBigramsScoreEffect() { - assertTrue(sh.isDefaultCorrection("pa", "page")); - assertTrue(sh.isDefaultNextCorrection("about", "pa", "part")); - assertTrue(sh.isDefaultCorrection("sa", "said")); - assertTrue(sh.isDefaultNextCorrection("from", "sa", "same")); - } -} diff --git a/tests/src/com/android/inputmethod/latin/UserBigramTests.java b/tests/src/com/android/inputmethod/latin/UserBigramTests.java deleted file mode 100644 index cbf7bd8e1..000000000 --- a/tests/src/com/android/inputmethod/latin/UserBigramTests.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2010 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 android.test.AndroidTestCase; -import com.android.inputmethod.latin.tests.R; -import java.util.Locale; - -public class UserBigramTests extends AndroidTestCase { - private static final String TAG = "UserBigramTests"; - - private static final int SUGGESTION_STARTS = 6; - private static final int MAX_DATA = 20; - private static final int DELETE_DATA = 10; - - private SuggestHelper sh; - - @Override - protected void setUp() { - int[] resId = new int[] { R.raw.test }; - sh = new SuggestHelper(TAG, getTestContext(), resId, MAX_DATA, DELETE_DATA); - } - - /************************** Tests ************************/ - - /** - * Test suggestion started at right time - */ - public void testUserBigram() { - for (int i = 0; i < SUGGESTION_STARTS; i++) sh.addToUserBigram(pair1); - for (int i = 0; i < (SUGGESTION_STARTS - 1); i++) sh.addToUserBigram(pair2); - - assertTrue(sh.isUserBigramSuggestion("user", 'b', "bigram")); - assertFalse(sh.isUserBigramSuggestion("android", 'p', "platform")); - } - - /** - * Test loading correct (locale) bigrams - */ - public void testOpenAndClose() { - for (int i = 0; i < SUGGESTION_STARTS; i++) sh.addToUserBigram(pair1); - assertTrue(sh.isUserBigramSuggestion("user", 'b', "bigram")); - - // change to fr_FR - sh.changeUserBigramLocale(getTestContext(), Locale.FRANCE); - for (int i = 0; i < SUGGESTION_STARTS; i++) sh.addToUserBigram(pair3); - assertTrue(sh.isUserBigramSuggestion("locale", 'f', "france")); - assertFalse(sh.isUserBigramSuggestion("user", 'b', "bigram")); - - // change back to en_US - sh.changeUserBigramLocale(getTestContext(), Locale.US); - assertFalse(sh.isUserBigramSuggestion("locale", 'f', "france")); - assertTrue(sh.isUserBigramSuggestion("user", 'b', "bigram")); - } - - /** - * Test data gets pruned when it is over maximum - */ - public void testPruningData() { - for (int i = 0; i < SUGGESTION_STARTS; i++) sh.addToUserBigram(sentence0); - sh.flushUserBigrams(); - assertTrue(sh.isUserBigramSuggestion("Hello", 'w', "world")); - - sh.addToUserBigram(sentence1); - sh.addToUserBigram(sentence2); - assertTrue(sh.isUserBigramSuggestion("Hello", 'w', "world")); - - // pruning should happen - sh.addToUserBigram(sentence3); - sh.addToUserBigram(sentence4); - - // trying to reopen database to check pruning happened in database - sh.changeUserBigramLocale(getTestContext(), Locale.US); - assertFalse(sh.isUserBigramSuggestion("Hello", 'w', "world")); - } - - final String[] pair1 = new String[] {"user", "bigram"}; - final String[] pair2 = new String[] {"android","platform"}; - final String[] pair3 = new String[] {"locale", "france"}; - final String sentence0 = "Hello world"; - final String sentence1 = "This is a test for user input based bigram"; - final String sentence2 = "It learns phrases that contain both dictionary and nondictionary " - + "words"; - final String sentence3 = "This should give better suggestions than the previous version"; - final String sentence4 = "Android stock keyboard is improving"; -}