Commit Graph

216 Commits (9ebba46c775f37abeb0451602cb323fd45adf33b)

Author SHA1 Message Date
Tadashi G. Takaoka 6e3f307266 Refactor SpellCheckerProximityInfo as extending ProximityInfo
Change-Id: I544eec9d661796d57749dbaa2163bc1e2a891353
2013-04-02 19:06:32 +09:00
Satoshi Kataoka 3c8117c88f Fix appname
Bug: 6789579
Change-Id: Ic4694e36e0846af95fa8dcdef919be251983b528
2013-03-22 16:19:44 +09:00
Jean Chalard 0cc0544a29 Merge the dictionary pack in Latin IME.
Bug: 8161354
Change-Id: I17c23f56dd3bc2f27726556bf2c5a9d5520bd172
2013-03-19 15:40:14 +09:00
Jean Chalard 1c5b2a41ec Cleanups
Follow-up to Idc6f419a

Change-Id: I4aae8f4e19f27a0a309879dc19af6e40906d58c5
2013-02-11 21:14:56 -08:00
Tadashi G. Takaoka 8aa9963a89 Fix Apache license comment
Change-Id: Ic56167f952a7f4449da366e1e81610e72c966086
2013-01-21 22:23:37 +09:00
Jean Chalard d8590857bd Fix spell checker subtype list.
Remove the subtypes that don't get a dictionary any more in AOSP.
Also prepare for all downloadable-dictionary supported subtypes.

Bug: 7673670
Change-Id: I5b754a791233c270237b8f7e5e2208f7282ad294
2013-01-11 14:59:34 +09:00
Jean Chalard f1b464da31 Remove a useless member
Change-Id: Id13e0aeec6ec3655d6bb0edc7f8f7821e7dc5a36
2012-12-11 19:15:24 +09:00
Jean Chalard 95bfb8ac47 Fix wrong misspelling reports of fully capitalized words
Two flavors of words would be wrongly reported as misspelled
by the android spell checker when they are written in all
upper case letters:
- Words containing a quote or a dash or any other non-letter
- Words that need the first letter to be capitalized

Bug: 7659216
Change-Id: Ibc5d261945ffcbb8a858d4c73b7c62cef6671abf
2012-12-04 18:05:27 +09:00
Tadashi G. Takaoka 7f77aed507 Merge "Replace useless CharSequence to String" 2012-10-22 14:27:35 -07:00
Tadashi G. Takaoka 15f6d4ae34 Add @UsedForTesting and @ExternallyReferenced annotations
Bug: 7268357
Change-Id: I0b7e0c19f04af9ae30874d0a4c26ad81bc80be8c
2012-10-22 11:18:43 -07:00
Tadashi G. Takaoka bc464e2952 Replace useless CharSequence to String
Change-Id: Idc478f901185ee1b4912acc82d0cbc54fee4e991
2012-10-22 11:03:28 -07:00
Tadashi G. Takaoka a28a05e971 Cleanup: Make some classes as final
Change-Id: I6009b3c1950ba32b7f1e205a3db2307fe0cd688e
2012-09-27 19:03:30 +09:00
Satoshi Kataoka 17f7b406aa Clear cache of user dic
Change-Id: Iec2793de3fff7bf15f68f82a50331de7742b7049
2012-09-19 20:11:45 +09:00
Tadashi G. Takaoka 5f282ea9e4 Add CollectionUtils class to create generic collection easily
Change-Id: I6b4de9187e122298e5e9cd8ddc9070d062df6a89
2012-08-22 10:21:38 +09:00
Tadashi G. Takaoka ac78633be2 Rename and consolidate some constants
Change-Id: I7863936cca18b28bf0117afcbcf544a5fd7f185d
2012-08-21 17:54:53 +09:00
Jean Chalard 46fc768e54 Remove the whitelist dictionary.
The functionality now lives in the binary dictionary.

This finalizes work on
Bug: 6906525

Change-Id: Id106d871e8afdf9afa886d2a30bea87ff89f2d24
2012-08-17 15:13:10 +09:00
Jean Chalard 653dbfb8ed Ensure #offer always actually offers something.
This will allow remaining requests after a call to terminate
correctly.

Bug: 6963142
Change-Id: Iff67058bb8a39f2f1b468d3894861e8125de6659
2012-08-15 18:10:10 +09:00
Jean Chalard e30c05800f Preemptive anti-deadlock device
We don't know of any actual bug in the implementation of the
pool that may result in a deadlock, but this still implements
a means out of a deadlock if one ever arises anyway. It's
meant to improve the resilience of the spell checker.

Bug: 5441027
Change-Id: I689491090792dbb89110ee56631965c5bb2dc712
2012-08-14 17:04:14 +09:00
Jean Chalard 5d6b8e1818 Fix a bug that would prevent spell checking
java.lang.ArrayIndexOutOfBoundsException:
        [I offset=0 length=528 src.length=512
com.android.inputmethod.keyboard.ProximityInfo
        .setProximityInfoNative(Native Method)
com.android.inputmethod.keyboard.ProximityInfo
        .createSpellCheckerProximityInfo(ProximityInfo.java:85)
com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService
        .createDictAndProximity(AndroidSpellCheckerService.java:411)

The array was too small with respect with the passed size.

Change-Id: I7777d7aecd17375d3fbf82854a66eb7a5a289ce6
2012-08-14 14:45:17 +09:00
Jean Chalard 82009901ea Add a consolidated method to the Dictionary interface (A85)
Change-Id: I5d79021e69cc738e3013e31764ab0a59e15decdf
2012-07-10 18:57:12 +09:00
Satoshi Kataoka 7fcad7b9b6 Separate ICS-dependent code from the spell checker service
Bug: 6789576
Change-Id: Ia768258f6fa121c7a7757093eb8a20e665580865
2012-07-10 17:45:26 +09:00
Satoshi Kataoka 37b19ffe6c Create AndroidSpellCheckerSessionFactory
Bug: 6789576
Change-Id: I6de1e1aa64cf14f38ecb250579418bc518f0d838
2012-07-10 16:16:53 +09:00
Satoshi Kataoka 84ed096641 Separate SpellCheckerSession from SpellCheckerService
Bug: 6789576
Change-Id: I7c55d36afad7ef6046353b3c9e849a54a6dc83ae
2012-07-10 15:34:40 +09:00
Tadashi G. Takaoka 5c641a9f59 Remove WordComposer.add(int, int, int, KeyDetector) method
Change-Id: Ie6af46acba18a2d1cf3ddd1578d60ded4c90f89a
2012-07-04 17:29:47 +09:00
Jean Chalard 0a79446531 Remove a meaningless separation (A18)
Change-Id: I267177044c7d7b0d9119839a11057b2bbf41f75f
2012-06-26 17:59:04 +09:00
Jean Chalard 61e7ec6587 Remove the Callback interface for simpler code. (A17)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530

Change-Id: I009b54fc2e73cadca6734bdca074d033e81f6a2b
2012-06-26 17:58:52 +09:00
Jean Chalard 2f1b6c9ea4 Remove the callback argument to getBigrams() (A16)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530
Change-Id: I7457ac04f8cd4019fb86c986725aae3de1b1a65e
2012-06-26 17:54:49 +09:00
Jean Chalard 2225b3bace Do away with Utils#addAllSuggestions (A14)
It's not used any more.

Change-Id: Id9da40fdbf7078f3ac647d1368237d6601f5a2ba
2012-06-26 17:36:47 +09:00
Jean Chalard d9df8094e6 Neutralize AndroidSpellChecker.SuggestionsGatherer#addWords (A13)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530
Change-Id: Ia54e1e44e1fd4e8ba2c9316928c0595cbe3f933c
2012-06-26 17:36:47 +09:00
Satoshi Kataoka 7368009799 Change JNI for Gesture
Change-Id: I774a0052038d16677f60f7efa11fd266cb5f3088
2012-06-25 18:54:37 +09:00
Jean Chalard 67fd0c240d Remove deprecated classes.
Should we maybe rename back *BinaryDict* to *Dict* in another
change for simplicity?

Change-Id: I8f7dcb78b9bdf1a13ce403a997fbb8619f2b453b
2012-06-08 17:12:15 +09:00
Jean Chalard c8a120f970 am eead5492: am 769cecf7: Close spell-checking dictionaries in a background thread
* commit 'eead5492615f0b05ef85ca1f88d3a41ce3f8d496':
  Close spell-checking dictionaries in a background thread
2012-06-06 21:52:46 -07:00
Jean Chalard 769cecf7e7 Close spell-checking dictionaries in a background thread
Bug: 6584677
Change-Id: Ifd9b0f995f4e0cf4d35a7ecde767826ab976f0b8
2012-06-07 12:56:45 +09:00
Satoshi Kataoka 547bc0cf04 Cache bigram results in Android SpellChecker
Bug: 6610579
Change-Id: I255c068f64f99ee80abda49153ed8ea009ca8ad3
2012-06-06 16:58:24 +09:00
Jean Chalard a6166d3776 Fix a bug where Latin IME crashes on spell checker request
Bug: 6611183
Change-Id: I8a879feb598e1ac55d73f9cb27e54aa533d3a010
2012-06-05 16:33:21 +09:00
Tom Ouyang 7f7739fee8 Merge "Fix a bug where the spellcheck is using the old non-binary contacts dictionary" into jb-dev 2012-06-04 23:10:03 -07:00
Tom Ouyang faf0059f35 Fix a bug where the spellcheck is using the old non-binary contacts dictionary
Bug: 6607023
Change-Id: I6dc120dea23052a0841e281c20706bfb21fd9876
2012-06-04 14:07:47 -07:00
Jean Chalard b1f3c24c63 Read the script correctly
The script of a language presumably does not depend on the
country variant. This was how it was made but it was later
forgotten and the full locale was registered.

Bug: 6542210
Change-Id: Iebc90c546f9c8caf89f8aa6c6a7c4733e5bcba48
2012-06-04 18:39:16 +09:00
Tadashi G. Takaoka 93ebf74bae Clean up some compiler warnings
Change-Id: I604da15e65fc3cf807ec4033df4e4cd5ef0196fc
2012-05-25 19:04:54 +09:00
Jean Chalard d527a15ec4 Add new locales for the spell checker.
Bug: 6533167
Change-Id: I1581e8446b1af5dc3679e01be16d4fc34af725cc
2012-05-24 18:45:58 +09:00
satok 315d731d8f Support bigram suggestions in Android spell checker
Bug: 6136291
Change-Id: Ic278153f95b23e9aa180d1d6b5960785766d96e5
2012-05-24 12:27:33 +09:00
Tom Ouyang f6adff6227 Change to a binary version of the expandable user dictionary.
Bug: 6435677
Change-Id: If83409f699608d443796e64a3c65692ae81b98e6
2012-05-17 15:12:00 -07:00
satok 0028ed3627 Use "float" instead of "double"
Change-Id: I93ed4d88ede4058f081dd8d634b00dfff4e96d07
2012-05-16 20:45:05 +09:00
Jean Chalard f0e12a9699 Don't auto-correct when there is no main dictionary.
Bug: 6502485
Change-Id: I5803b0db8552867110587a1140fc03fc2e0eccef
2012-05-16 16:09:14 +09:00
satok 5434f46481 Remove unexpectedly split words with single quotes
Bug: 6451163
Change-Id: I4c5595f727934f2b401e9bb11a6ba613668f4a42
2012-05-11 18:49:29 +09:00
Ken Wakasa 88794b24c0 Remove the dependency to SpellCheckerProximityInfo from ProximityInfo.
In conjunction with I596b2deb

Change-Id: I42f059158ae78e1c1c807ed4d3688edbcf18c006
2012-05-11 17:03:06 +09:00
satok e58f3af8a7 Treat apostrophe as single quote in spell checker
Bug: 6435348
Change-Id: Iaaac9042e7e6cb21a3f2243bc6e8e055cc24f74d
2012-05-07 22:21:55 +09:00
satok 74a84febc7 Cache results of the spell checker
Change-Id: Ie11cd1b07e069474b140fbaae65fca703adc056f
2012-04-17 19:45:57 +09:00
Jean Chalard ac27e4544b Pass the previous word to getSuggestions
This is a preparative change to bug#6313806

Change-Id: I1be9ec49b21005c1f45ce459fa93712bc74ef3f0
2012-04-17 12:43:53 +09:00
Tom Ouyang 18222f8c86 Add a new binary contacts dictionary based on ExpandableBinaryDictionary and use locale for bigrams.
Bug: 6188977
Change-Id: I753422eed1effaeb5fd01124cf1ddd1e31ee9d60
2012-04-13 17:54:39 -07:00
Jean Chalard e6269759d6 Read the dictionary resource in a more sensical place.
We don't need to pass this down all the way from LatinIME any more.
It fetched be done exactly where it needs to be.

Change-Id: I9f277f9c4f9de70ae755a1334d86c67bbb24c988
2012-04-11 21:03:21 +09:00
Tadashi G. Takaoka 78ab80844b Add language suffix to main dictionary
Bug: 6319377
Change-Id: Ie6a887fefa12e33c17bfeb5d22984e7c1a7bdb46
2012-04-11 16:11:34 +09:00
Jean Chalard b5e1f48987 Remove the now useless Flag class.
Change-Id: Ibe45189b73e2606cf77e30da166dd0d45ae47c5c
2012-04-06 19:47:16 +09:00
Jean Chalard 24aee9100e Change the flags to a boolean in constructors.
Change-Id: I9939204f3b16346aaebd4d726315ba9c4faf910a
2012-04-06 19:33:01 +09:00
Tadashi G. Takaoka 11d9ee742f Use keyboardSet extra value of subtype to specify layout type
Change-Id: Ice1f345a08a8d760e3b847c885c4072e3e142c97
2012-04-05 17:25:15 +09:00
Tadashi G. Takaoka 3bf57a5624 Use "No language (QWERTY)" for language agnostic QWERTY keyboard name
Bug: 6010147
Change-Id: I401c2e3fcd639c0e1a03e64489a0d792810caa18
2012-04-04 12:58:42 +09:00
Ken Wakasa 672635493e Remove ArraysCompatUtils
bug: 6129704
Change-Id: I0f1a0dee744e6dcdea7ae8606119b4af22b86663
2012-03-30 22:50:53 +09:00
Jean Chalard 8403611960 Split a method for reuse
Change-Id: I9a82e538903f05bedad51bc195866abbd9daf957
2012-03-26 16:34:29 +09:00
Jean Chalard b0b89c87f6 Fix a native crash
-1 & 0xFFFF is 65536 :p

Change-Id: I8ecb882b6d6c5bcc91b52e23eb9cc02b04fcdd34
2012-03-23 22:36:00 +09:00
Jean Chalard e5f02cff7a Small optimization
Change-Id: I5dd7c848f2aaec20325e7ee85f27e282e1ba7a85
2012-03-23 17:03:55 +09:00
Jean Chalard 081616cd2f Send correct coordinates for the spell checker
This results in the computation being done in native code
and the correct proximity being used.
Bug: 6181080

Change-Id: I08fa05c781d607e4feca2caeda353ec19c133a3d
2012-03-23 13:02:58 +09:00
Jean Chalard 330cd291fa Make some constants more explicit.
This wasn't very obvious, but the actual values are critical, so
make it more readable
Bug: 6181080

Change-Id: I07461d2df4c796dad0cb6f5283e41a28036d023c
2012-03-22 14:28:05 +09:00
Tadashi G. Takaoka cc8c8b99bd Split Utils class to StringUtils, SubtypeUtils, and JniUtils
Change-Id: I09e91675fe7d573dad8c933ad513b21d7e409144
2012-03-08 20:30:38 +09:00
satok ca7ec2097c Integrate the logic to calculate the proximities
Bug: 4343280

Change-Id: I0f6a7e6912ed4abea07c10d266da4c7ccb0dae76
2012-03-06 15:34:27 +09:00
Jean Chalard 9242a2bcf8 Fix string iterations in a couple places.
Seems I didn't get how to iterate on a String correctly >.>
Talk about a big bug. Anyway, I think it's working now.

Bug: 5955228
Change-Id: I988c900cf2a16c44b9505cfd4f77c7cda7e592f0
2012-02-03 11:15:46 +09:00
Jean Chalard 6e082cb30d Convert an internal enum into an int of same underlying value.
Goes together with Id4f4e066

Bug: 5922118
Change-Id: I1e39dd01c67e9284d9d7fe008d868847e69986d7
2012-01-26 13:07:51 +09:00
Jean Chalard 0bfe359ee4 Add a test for auto-correction.
Fix two related subtle bugs:
- Stop singling out fat-finger-only corrections for rejection
  when touch coordinates are not available.
- Remove a racy check that would happen only in debug mode

Change-Id: Ic904f9b27c091ca6b369052c4e65a630bff81257
2012-01-25 19:29:40 +09:00
satok be0cf72253 Move auto correction thresthold to the native code
bug: 5858137

Change-Id: Ic4b6270c6e51ef4ed25a6a1d8ddd7fdfa70fd78d
2012-01-12 19:56:15 +09:00
Tadashi G. Takaoka 2d74806262 Change visibility to avoid synthetic accessor method
Change-Id: Ie93c7437fb9a3fe63adaa48c2d4a723f96c0a0e1
2011-12-15 19:50:53 +09:00
Ken Wakasa 9260422423 Build God Mode keyboard with API level 14
Change-Id: I29ab9e9041c9faac91dc303175625221bfdb3af8
2011-12-10 03:45:40 +09:00
Jean Chalard 1830cd1dc8 Add proximity for Russian.
This also tries to make the code as easy to extend as possible
for future developments.

Bug: 5701241
Change-Id: I1ed48e6a5cc7aab94c5d6e309930cc004247d7e7
2011-12-08 19:00:52 +09:00
Jean Chalard bb2b30fc7f Add support for Russian spell checking.
Note that this is not enough: we still need to create a
reasonable proximity table for Cyrillic characters, or we
won't be able to show up suggestions.

Bug: 5701241
Change-Id: Idb141f7a230a6e1a46094308c26f43c01ab3b97a
2011-12-05 18:57:03 +09:00
Jean Chalard db5aedb5a5 Add an option to use contacts or not while spell checking
Bug: 5447495
Change-Id: Iffb09895676c3dd1a79d1699b0eac865282508d4
2011-11-30 18:58:10 +09:00
Jean Chalard 85170a9c17 Merge "Be stricter for ruling characters out of spell checking" 2011-11-10 15:51:45 -08:00
Jean Chalard 72479ea363 Be stricter for ruling characters out of spell checking
Bug: 5548308
Change-Id: Ie8025b02424b72b69a07907cde1093830c2d4d3d
2011-11-10 12:57:09 +09:00
Jean Chalard a409f009fa Fill in the HAS_RECOMMENDED_SUGGESTIONS flag.
Bug: 5530727
Change-Id: Ic53e227f72096053e08d90204bf1f287ec09290b
2011-11-10 02:52:46 +09:00
Tadashi G. Takaoka 8fbf29e2d5 Make some private method static
Change-Id: Ia23765268be0ef89d7fe7c3f5372ed32d6615765
2011-10-28 13:31:31 +09:00
Jean Chalard cba1af9c56 Fix a bug where the sequence numbers would be wrong
The spell checker cannot afford to return static objects,
seeing as the framework will then use the same objects to
pair the cookie and sequence ids to the request.

Bug: 5503243
Change-Id: Ia9c3a933bfb30cf5525418b240ef60632d72c9d0
2011-10-24 22:40:41 +09:00
Jean Chalard 2e3c6da868 Use the contacts dictionary in the spell checker.
Bug: 5447495
Change-Id: I7292eb291a1630265884cc8e505a2e83a74f0c72
2011-10-24 19:44:01 +09:00
Jean Chalard fee149abe0 Use the whitelist as a dictionary in the spell checker.
Bug: 5402436
Change-Id: If89b8bbdebf6751697c4788270d01d4639cff665
2011-10-07 19:25:36 +09:00
Jean Chalard 3d36cdcd2d Merge "Fix possible NPE in debug mode" 2011-10-06 03:44:24 -07:00
Jean Chalard 51075d145a Fix possible NPE in debug mode
Change-Id: I55776110a489621c99e9a3bf58daa6fcaf415cb3
2011-10-06 19:36:40 +09:00
Jean Chalard c53661f152 Fix a possible OutOfBoundsException
Change-Id: I6eb13c228738119c78496a96acaedbccefd83cd3
2011-10-06 19:05:23 +09:00
Tadashi G. Takaoka ab72a97d7c Cleanup unused import
This change also gets rid of several compiler warnings.

Change-Id: I23962edaadad18a6e0395d528af17b909dcf5dad
2011-10-04 12:46:20 +09:00
Jean Chalard 673cebf9e9 Make use of the FULL_EDIT_DISTANCE flag.
In effect, this stops the spell checker from suggesting overly
long words.
More precisely, it takes advantage of the new facility that
takes into account the whole length of the dictionary word when
computing scores, so words much longer than the input word will
see their score demoted accordingly.

Bug: 5384578
Change-Id: I326cd7c87c3080e7fa8729f78517f8ba13672a9b
2011-09-30 16:00:07 +09:00
Jean Chalard 4609c02f9e Add a threshold for suggestion score.
Bug: 5384578

Change-Id: Ic0b0203d873492a41c72defef835adf36f010f47
2011-09-29 17:38:08 +09:00
Jean Chalard 85782abaf1 Move some arguments to final members.
This is preparation for
Bug: 5384578

Change-Id: I7d493c441f375fa5f23c5e3cfa8134e2ce7775fe
2011-09-29 13:11:09 +09:00
Jean Chalard 647db70fec Change the logic of the LOOKS_LIKE_TYPO flag
It now follows the following logic:
- If the word should be filtered out => false
- Else => !IN_THE_DICTIONARY

This defines the behavior for ICS MR0, and prepares for addition
of a new HAS_LIKELY_SUGGESTIONS flag in MR1.

Bug: 5383800

Change-Id: I530b1404ae8cf3337ff68ef5ab0f4d95f2dad0e8
2011-09-28 19:42:43 +09:00
Jean Chalard a9876980c8 Fix a possible deadlock.
Bug: 5359873
Change-Id: I80ae901c43b6ae59879e3c8b1a9dd8a937d558c1
2011-09-26 18:16:24 +09:00
Jean Chalard e897e4d342 Have the spell checker report IN_DICT correctly
...even if the word is filtered out.
This also contains minor refactoring.

Bug: 5329658
Change-Id: I397a2a74f819a51df3bd07c6b94e8d29244389c4
2011-09-16 18:26:02 +09:00
Jean Chalard 97ec205504 Merge "Add an option to user dict to match more precise locales" 2011-09-15 02:28:20 -07:00
Jean Chalard cfed273922 Add an option to user dict to match more precise locales
This should not be used lightly, as it violates the general
contract of locale, and does kill some legitimate (albeit
alledgedly rare) use patterns.
Currently, the spell checker uses this because it uses a
negative logic: it should match broadly, and when in doubt,
match even more broadly, which is almost never the case of
something that uses the locale.
In other words: don't use this option unless you are
very, VERY sure that's what you want. Hint: it isn't

Bug: 5280929
Change-Id: Ib3cae319c692161d653630038c5bcde1f4340c05
2011-09-15 18:01:13 +09:00
Jean Chalard 199dc5e0e4 Don't kill LatinIME if the spellchecker crashes.
If the spellchecker encounters a bug and happens to crash,
it may be sensible to avoid killing the keyboard in response.
This is a possible way to do it, which comes with the big
drawback of making bugs in the spell checker harder to find.

Change-Id: Idb26fb592b9718e1dbdadeda8fbd1a8a1d805c28
2011-09-15 16:01:21 +09:00
Jean Chalard 88fa53b840 Filter out of spellchecking words that don't look like words
Note that this affects only the results of the spell checker if
actually passed such a word. For example, the spell checker will
not flag "http://oju" as a typo, because it looks like a URL.
But in the current implementation, TextView passes "http" and
"oju" separately, so "oju" is still flagged as a typo.

Bug: 5281875
Change-Id: I9d721fd3af34edc51b11908cf2e8fe994b164242
2011-09-14 17:46:06 +09:00
Jean Chalard 63e55cd55e Don't report 1-char words as typos
Bug: 5281875
Change-Id: If6b6d057e18390bf01dcd31c46104b6856fbdbda
2011-09-13 21:45:19 +09:00
Jean Chalard f5ef30dfc6 Have the spell checker honor case
Bug: 5281103
Change-Id: I415c84dbb55f1eeb5deb9f248b4056881982ee13
2011-09-12 12:25:25 +09:00
Jean Chalard af3b56c887 Fix a bug where the wrong suggestion score would matter.
Also introduce a few debug prints.

Bug: 5240463
Change-Id: Iea2fffa3be9d7bd69da751ece9e67e94e9819ee1
2011-09-08 21:17:24 +09:00
Jean Chalard 59b501a050 Only set LOOKS_LIKE_TYPO if the max score meets a threshold
Bug: 5240463
Change-Id: I51e85edae57789d638aa1e12b82e6a75c49d33c7
2011-09-05 12:31:43 +09:00
Jean Chalard f019d505d7 Fix a bug with synchronicity of spell checking/user dict
This fixes a race condition that would end up with the spell
checker not finding some words in the user dictionary when it
just booted.

Bug: 5194627
Change-Id: I1ba911cc53e6ae3b111d54a6f91d1d5feef3f5de
2011-08-29 18:33:20 +09:00
Jean Chalard ef35cb631c Move locale-related utility methods to LocaleUtils.
Change-Id: I7e9e6e5bc4486d8618d0213b112308c3d305c15e
2011-08-29 12:29:35 +09:00
Jean Chalard 6b166a1933 Remove duplicates from the spell checker suggestions.
Bug: 5175740
Change-Id: I592401b3b8c3074d70e06dc3a9919cc3cb47ba49
2011-08-22 18:44:04 +09:00
Jean Chalard 5d4c5692f1 Fix case sensitivity for the spell checker.
The new behavior is as follows:
- If the word in the dictionary is not fully lower case, then the
exact case is required to match.
- If the word in the dictionary is fully lower case, then any of
the following patterns match:
  - fully lower case
  - only the first char capitalized
  - all caps
Any other capitalization is rejected.

This is probably what people want. If you type a name in all lower
case, it should be marked as a typo, but if you type a word with a
capital for emphasis or just because it's the start of the sentence,
it should match a lower case word in the dictionary. If you have
a spurious capital letter in the middle of a word because of a typo,
it should be marked as such.

Accents are not affected, and should not be. An accented letter
is a different letter and a missing accent should be reported.
We should maybe consider again for some common transpositions
like the "ue" digraph for German, which is now considered a typo,
but will suggest the correct diacritics as the first suggestion.

Bug: 5145751
Change-Id: I651e24f13c90fb94700a1674ad380e95336e7dca
2011-08-22 14:02:57 +09:00
Jean Chalard 150bad6fd4 Have the spell checker use the User dictionary.
Bug: 5175868
Change-Id: I165eee4c865caa5ee1daf3e0b1acde8788b996ef
2011-08-19 17:19:49 +09:00
Jean Chalard c160373b6a Close dictionary pools when they are not used any more.
Bug: 5156851
Change-Id: Icaba54734eb790b40dc2012aac25df5b2af71dbb
2011-08-16 20:04:57 +09:00
Jean Chalard a562767a14 Have a pool of dictionaries to check spelling.
The dictionaries and proximities are not thread-safe. In order to
be able to check spelling in parallel, make a dictionary pool to
call upon when a spelling check is necessary.

Bug: 5156851
Change-Id: Ie3796164187dd7b7abf5ccd5d014073d43d74408
2011-08-16 18:13:12 +09:00
Jean Chalard 70b9c5d991 Make the spell checker re-entrant.
Until the dictionary itself is re-entrant, unfortunately we have
to synchronize accesses to it.

Bug: 5156851
Change-Id: I1629a160d707e6fa1ad80cba828798abb24b68b1
2011-08-16 13:58:37 +09:00
Jean Chalard 31fd54c53f Add a settings activity for the spell checker.
Bug: 5156940
Change-Id: I762de1296f861abce2d0413404bca54571e0ea0a
2011-08-12 19:07:51 +09:00
Jean Chalard f098fbbef3 Add proximity info for the spell checker.
Bug: 5119987
Change-Id: I35700fd8b0ffa6bced428cc6d46b3f64eb251281
2011-08-09 17:24:28 +09:00
satok 5bcf8ee66c Update the spell checker according to API cleanup
Change-Id: Ia95a63963c16265bc9bc7e1fcecf120e17bf8636
2011-08-05 19:57:47 +09:00
Jean Chalard 3234123fba Implement the spell checker.
Bug: 4176026
Change-Id: I297c47202e96ce0db74d703f30709777f26b93ac
2011-08-04 21:27:14 +09:00
Jean Chalard 043f784198 Create a way to pass the proximity info to the dictionary
This is a preparative change for inserting the spell checker.

Change-Id: Ie441879cac4f67078ec27a95f1fcbbf3ef373df7
2011-08-04 19:46:21 +09:00
satok 55d1c5efab Temporary don't use "looks type" for comming rename cl.
Change-Id: If016a61f9e303b615c59c0035724256535aec817
2011-08-03 18:42:56 +09:00
satok a90992e562 Modified the test spell checker
Change-Id: Ib64fac8672a4107638cd05a0232d46b49fc4aa8c
2011-07-28 20:55:00 +09:00
satok 022c1cc203 [step3] Add spell checker service.
Change-Id: Ib13b3a524e0f0b90de40a3e255040b3158d49258
2011-07-25 11:05:24 +09:00
Tadashi G. Takaoka acd1a1c7a8 Add ArraysCompatUtils.binarySearch
Until API version 9, java.util.Arrays.binarySearch(int[], int, int,
int) doesn't exist.

Change-Id: Ife0ed4fbac642eda069e7b6f6b8dd30e0cd5fdee
2011-06-21 17:02:38 +09:00
Jean Chalard 8fd75b3147 Add spell checking core methods.
Bug: 4176026
Change-Id: Ic6ea3e084b3ebacfc5fd998d2c7b0130f7b0ec48
2011-06-03 17:11:16 +09:00