Commit Graph

239 Commits (f5b55cb70c9d6012e1aa2b201c4785530afab168)

Author SHA1 Message Date
Jean Chalard 24eec0fa68 Remember the source dictionary for each suggestion.
Change-Id: I3c63372bd5572a479a67eaecfe8c8ea1cabc70d9
2012-06-27 18:17:28 +09:00
Jean Chalard d8f0caa406 Move constants to a better place.
Change-Id: I5c27a3ed99b17f850e26a8503de16f001c7111c1
2012-06-27 18:08:08 +09:00
Jean Chalard 089c11a086 Cleanup
Change-Id: I575f22330bf6881af1d9a35f22b51b7bf2198113
2012-06-27 17:59:58 +09:00
Jean Chalard b5afd3de0c Remove unused stuff.
Change-Id: Ifd0d5b6978f76b841574a6e10157c32d0cd656b6
2012-06-27 17:44:16 +09:00
Jean Chalard 32ff2504a0 Update the prototype of onAddSuggestedWord - calling side.
We want to get rid of all those IDs in Latin IME.

Change-Id: Ibe08100a5e2976c80abb049889233b4047a686f3
2012-06-27 16:17:14 +09:00
Jean Chalard 56beb9e321 Use binarySearch instead of a hand-written linear search
Yay.

Change-Id: Icf686eb2d675da959f19edc856b521e6288dcea3
2012-06-27 14:17:29 +09:00
Jean Chalard 9da0027b38 Implement a comparator for SuggestedWordInfos.
Change-Id: Ic4b0ae05cd98a1aec5806c5e4b744158e73aea7a
2012-06-27 14:16:23 +09:00
Jean Chalard 4ef01c51f8 Merge "Remove some special casing" 2012-06-26 20:33:43 -07:00
Jean Chalard 7e49a2b6b8 Remove some special casing
This special casing is useless. If the word is the same as what
user typed, the scoring algorithm already ensures that it comes
out at the top. Actually, as is written in a comment here, code
executed later is actively relying on this suggestion having
the top score ! There is no need to test it for equalness and
inserting it at the top then.

Change-Id: I263a6de59b77ec72a2dcbb933361b8e16fca0681
2012-06-26 20:40:42 +09:00
Jean Chalard a3f5f51ec4 Fix a bug where a log would mysteriously not work
Change-Id: I5ca77ed65e95a6d357215c0e730238fb463986bb
2012-06-26 20:36:51 +09:00
Jean Chalard 22657dcba0 Optimization.
We already had that computed

Change-Id: I2a9742eaee2e9db1f73aeddda7bae7e237b4d15c
2012-06-26 20:02:07 +09:00
Jean Chalard ec8b27fe49 Cut out a method for clarity
Change-Id: I1dc668698a5cd840297e713a26a525f5e32d35d6
2012-06-26 19:49:01 +09:00
Jean Chalard 5953dc93cf Avoid string conversions when possible.
Change-Id: Ibf5f3e40da55998364d0d835ecf283f32c80fcf5
2012-06-26 19:45:52 +09:00
Jean Chalard bed514bd90 Simplify a method call.
Change-Id: Ieede787a13cef79353f13af52488ef3732ac9850
2012-06-26 19:33:16 +09:00
Jean Chalard 9433ce86b7 Refactor and squash long-standing bugs (A2)
This is awesome.
- Improve performance by stopping useless string/array conversions.
- Simplify method interface.
- Fix localization bugs - we now know our locale
- Fix bugs with surrogate code points

Bug: 4769095
Change-Id: I8a8ee224b713429ee0a4ce5bd52f1b63378cf56f
2012-06-26 19:12:07 +09:00
Jean Chalard 8e17f6d93a Remember the locale in the Suggest object (A1)
This will be necessary for uppercasing and titlecasing words
correctly.

Change-Id: I0f446a4c82bc482240ff730a2ad6586a61571d6b
2012-06-26 18:55:18 +09:00
Jean Chalard 6cad198d9c Remove a useless member (A2)
Change-Id: Ia727ffc2946352bbf79e0c97684f8fa98f428cef
2012-06-26 18:42:06 +09:00
Jean Chalard 0da9a7c094 Convert a member to a local variable (A1)
Change-Id: I9eab910989443704f83711cf4fb0070c5987a13a
2012-06-26 18:41:49 +09:00
Jean Chalard f05392f213 Remove an unused method (A22)
Change-Id: I2195f365df1799c8b3b2a53670d1df535ab1a742
2012-06-26 17:59:04 +09:00
Jean Chalard 6234be1fe7 Simplification and optimization (A20)
Change-Id: Ia837e553ccfe67cd4303096290194a5186df059b
2012-06-26 17:59:04 +09:00
Jean Chalard 77e95e60bb Preparation for a simplification (A19)
Change-Id: I4605a571faf5fbc68b18ce525d6019600bfa8cf7
2012-06-26 17:59:04 +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 60eed92dc3 Remove the callback argument to getWords() (A15)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530
Change-Id: I919bf70a1213ab5d7c7a9e5715bd72a6e257148b
2012-06-26 17:36:47 +09:00
Jean Chalard 7830476022 Neutralize Suggest#addWords (A12)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530
Change-Id: Id923367342a62a650a5f1d38e2fa0e913030dca8
2012-06-26 17:36:47 +09:00
Jean Chalard fd998bd37a Refactoring (A11)
Change-Id: I86bd7587dd80773a51ba6db312ba55dc41e7c8c7
2012-06-26 17:36:47 +09:00
Jean Chalard 64dad2d5a9 Remove an unused method and inline another (A10)
Change-Id: Ifd71ce79711b0c15c7764e97351dbb1b8e4c0c2d
2012-06-26 17:36:47 +09:00
Jean Chalard 28eeb35d14 Merge the interface of two methods that do the same thing (A9)
Change-Id: Ia5701d713d0fd5bb646b54a03a1a5602dad0a9e6
2012-06-26 16:55:09 +09:00
Jean Chalard 17111afcd6 Remove useless code and storage (A6)
This is only used as temporary storage to be then added to
the other variable, relying on the fact that it is hopefully
sorted. It's better to just add it right away to the final
storage.

Change-Id: I5da702ac9dc579593ab21feb2021a01e5dfdf4dc
2012-06-26 16:39:32 +09:00
Jean Chalard 5e0545d69d Remove a duplicate processing (A5)
This filtering is already done in native code. It's useless (and
costly) to do it again here.

Change-Id: Ide6794d7a8682a881f097f33e222f10d30f297bd
2012-06-26 16:37:05 +09:00
Satoshi Kataoka 7368009799 Change JNI for Gesture
Change-Id: I774a0052038d16677f60f7efa11fd266cb5f3088
2012-06-25 18:54:37 +09:00
Jean Chalard 0e8b1db948 Merge "Cleanup, part 6 (C6)" 2012-06-19 09:25:33 -07:00
Jean Chalard c03bd090ea Merge "Cleanup, part 4 (C4)" 2012-06-19 09:24:25 -07:00
Jean Chalard bd765d3355 Merge "Cleanup, part 3 (C3)" 2012-06-19 09:24:00 -07:00
Jean Chalard 8b538807a3 Merge "Make a variable final (A2)" 2012-06-18 10:30:19 -07:00
Jean Chalard 0176faf6c0 Merge "Add a kind to the suggestion for bookkeeping (A1)" 2012-06-18 10:30:10 -07:00
Kurt Partridge 6080f6878b Remove non-dictionary words and digit touch data.
Output to the ResearchLogger is now queued and only flushed if the word
the user was working on is a dictionary word.

multi-project commit with Ic713ec00777fbdcf4a937b3c77b995257e100fc7

Bug: 6188932
Change-Id: I9de15227ff51be23083d9096f1c1b3d83802fff7
2012-06-17 15:02:15 -07:00
Jean Chalard c5f1d998c2 Cleanup, part 6 (C6)
Change-Id: I184f3a336278559df255c5d600a98fbba468a243
2012-06-16 10:52:49 +09:00
Jean Chalard 9b233ecef2 Cleanup, part 4 (C4)
Change-Id: I2821ae71ec49e4b6b512157d17b80198f74321e4
2012-06-16 10:51:04 +09:00
Jean Chalard 5475e92b3f Cleanup, part 3 (C3)
Change-Id: Ib0be8dc26b6fa366a3dabeea940d466602073244
2012-06-16 10:46:18 +09:00
Jean Chalard 0998c48ac3 Make a variable final (A2)
This is never changed, and probably doesn't need to be.
It's public because it's going to be used elsewhere in a future
change

Change-Id: Iec8d65859c470de5e1fb0b05533356fbc3b8e91b
2012-06-16 03:10:54 +09:00
Jean Chalard e7d2ee3ec3 Add a kind to the suggestion for bookkeeping (A1)
This will help for debug as well as serve as groundwork for
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530

Change-Id: I74d0a7b943fb22c514ad79dc064d69ddf336d3ef
2012-06-16 03:10:36 +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 1b06b59e28 Fix a bug with a concurrent modification of a map.
Bug: 6538848
Change-Id: I1a8422356d9909213e53cfdc8c5bcc12eb48f19d
2012-05-24 19:38:04 +09:00
Tadashi G. Takaoka b5db270962 Remove unused private method Suggest.searchBigramSuggestion
Change-Id: I077c4c019676fefb8eac6042bd7db1b7ab33ca03
2012-05-23 15:32:48 +09:00
satok 0028ed3627 Use "float" instead of "double"
Change-Id: I93ed4d88ede4058f081dd8d634b00dfff4e96d07
2012-05-16 20:45:05 +09:00
satok f837b57bf5 Merge "Reorder suggestions result according to auto correction threshold" into jb-dev 2012-05-16 04:13:08 -07:00
satok db1939dbaa Reorder suggestions result according to auto correction threshold
Bug: 5413904
Change-Id: I3aa3a8109ba45d2129b58d8242866fd3dd3473cb
2012-05-16 19:58:48 +09:00
Jean Chalard ed49e4d82e Merge "Stop meaningless bigram computations" into jb-dev 2012-05-16 01:43:39 -07: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
Jean Chalard a86c0f1ea4 Stop meaningless bigram computations
Bug: 6313806
Change-Id: Idf765b40812a43de13aa166ed0b44c7b5f7cc218
2012-05-15 16:34:17 +09:00
satok 0142b997bf Do not set "SuggestionSpan"s for suggestions from the next word predicition
Bug: 6294817
Change-Id: I5010eafa5ba7e947743706adf7e722f4f0cfb415
2012-05-15 12:08:31 +09:00
Jean Chalard 4b5b46bb66 Don't autocorrect after suggestion resuming
Bug: 6105732
Change-Id: I92e7a9c6d6eb648f747c3b396d7993479fd8478a
2012-05-01 17:06:29 +09:00
Tom Ouyang 0806bb01d9 Binary bigram lookup checks both uppercase and lowercase when previous word is uppercase.
Bug: 6363029
Change-Id: I71a1ed5b88f54fcc15bfaf89d3645b8f17ebb821
2012-04-22 17:48:00 -07: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
Jean Chalard 338d3ec725 Replace the flags in getSuggestions with a boolean.
Change-Id: I0ec44df1979cb1dc21017ea290d2151a2af0e7cd

Conflicts:

	java/src/com/android/inputmethod/latin/Suggest.java
2012-04-06 19:34:48 +09:00
Jean Chalard 24aee9100e Change the flags to a boolean in constructors.
Change-Id: I9939204f3b16346aaebd4d726315ba9c4faf910a
2012-04-06 19:33:01 +09:00
satok 7540fd009d Merge "Fix the locale of the flags in BinaryDicitonary for tests" 2012-04-05 22:33:17 -07:00
Ken Wakasa aa300bb73a Don't draw red underline for manually picked words that came from bigram prediction
Change-Id: I544680c8b4b1baff71bd08168630a34e803c40b9
2012-04-05 20:50:27 +09:00
satok ae234abd21 Fix the locale of the flags in BinaryDicitonary for tests
Bug: 6129372
Change-Id: I5611f88b10c44261b6145c9dc8615b80e4341e77
2012-04-05 12:48:30 +09:00
satok 7e518d8b83 Combine candidate words and scores
Bug: 5240798
Change-Id: Ie56c1c2cfd7f365e771fee88c1ed15012448feed
2012-04-02 18:39:24 +09:00
Jean Chalard 9ffb94fa13 Rename the user history dictionary.
UserBigramDictionary -> UserHistoryDictionary.

Also update all methods, strings and comments, except those needed
for backward compatibility (which only include the name of the
database file).

Change-Id: I0bccea29880dc566b90100575b83baaa947b03ae
2012-03-19 12:03:51 +09:00
Ken Wakasa 660776e09b Small performance improvement by removing interface accesses.
Change-Id: I6d91f3b086470b79306dbe2874db9748b9e0eb5f
2012-03-17 01:53:51 +09:00
Jean Chalard 3187ba5dfe Remove a now-useless flag.
This has been moved to the SuggestedWords object and is now
represented by a single flag instead of a flag in each suggestion.

Change-Id: I6e9a7cff5a7701de7e61b4de13baac25c9a87b1b
2012-03-15 14:21:02 +09:00
Jean Chalard 03a3517075 Add info for obsolete suggestions in SuggestedWords
Change-Id: I9684c7b08244b34853ce8a99b6e9d885389f6687
2012-03-15 13:12:08 +09:00
Jean Chalard ca3e7cbdf4 Move a computation closer to where it's used.
Change-Id: I5aee4c36ceaacbb1dbfc47c011f1e4aec4b9dca6
2012-03-15 12:23:16 +09:00
Jean Chalard 271e5b6cb7 Some readability improvement
In-place replacements of visibly identical things.

Change-Id: I02b51bd7f63597e3428f0650b239e9a39ef5a7c7
2012-03-14 18:50:08 +09:00
Jean Chalard 0d0f182959 Cut out a private method to make things more readable
Change-Id: I791700890338e023bd86b8794dbc90379b91dc7d
2012-03-14 18:43:32 +09:00
Jean Chalard ac5e463402 Minor optimization
We know the size in advance, this may save a few allocations

Change-Id: I2fb9a725f34ba2da4f34ed335652f10447d5d166
2012-03-14 18:35:07 +09:00
Jean Chalard def4551c2a Some code simplification
Just write the same thing in a more succint manner

Change-Id: I08a2c5edd52a3502914541061fd5b6ee7a92ebc4
2012-03-14 18:33:57 +09:00
Jean Chalard 4a08b2f0e4 Cleanup & optimization
Renaming some variables, and obvious optimizations.

Change-Id: Ib716748e9f3d602cf276dcd4e73f3bcfb819585e
2012-03-14 18:29:06 +09:00
Jean Chalard f985efe39c Remove a useless parameter
Change-Id: I03005240238fb004c20b2df0d836796e2e8b307f
2012-03-14 18:12:12 +09:00
Jean Chalard bdf6d1b18b Remove a useless method
Change-Id: I208dd2e725e37c2fb3cd51fe48194679e5912f6b
2012-03-14 15:59:04 +09:00
Jean Chalard 7d55c891af Make the Builder private
Change-Id: I2184084f4b7729c4324f8291d548bd4c4c2872a1
2012-03-14 15:42:14 +09:00
Jean Chalard 5b0643f50d Re-sequence the last calls to build()
Change-Id: If77ee5aa9483d3ca03c52812f31665dee6468e99
2012-03-14 14:19:24 +09:00
Jean Chalard 88bf1ba526 Move up the static methods of the Builder
Change-Id: Ic3e07b745b7b24cae0f772ea49e0de615b44caf9
2012-03-14 13:10:22 +09:00
Jean Chalard e3afb7d192 Make the Builder fully immutable at last
Change-Id: Ie399ca7a9e76ccab44a92bc378d11f92392fed2c
2012-03-13 20:33:13 +09:00
Jean Chalard 6ffb5018c1 Straighten out the last bastion of the Builder
...and go for the kill

Change-Id: I5ad57211b250d2578ca22a5dae93344d52f9da80
2012-03-13 20:26:47 +09:00
Jean Chalard 2e2519ee91 Make still more members of the Builder final.
Change-Id: Ic455f97247da5e40d4939555ab639ecffef36e2d
2012-03-13 20:05:00 +09:00
Jean Chalard bd4ba23d2b Some code reorganization.
Use the same local variable inside both branches of an if.

Change-Id: I61f7d506d984f3723ec90604416d1875dd97cd8c
2012-03-13 19:54:56 +09:00
Jean Chalard b5eeb724fc Make some more Builder attributes final.
Change-Id: I3132b7fe4ee97c566736bfc21c3783cfc79fc7ff
2012-03-13 19:53:38 +09:00
Jean Chalard c60fea852d Make the suggested word list final in Builder.
Change-Id: I2ddfab00dc8c141fc989a051f16eb2b3571b7e86
2012-03-13 19:37:17 +09:00
Jean Chalard 08adb09e14 Remove unused stuff.
Remove 2 methods that were left only for tests to compile in
another project, but are not used any more now that the tests
have been updated.
Also remove an attribute that is never read.

Change-Id: Ic9ba1f52a465199c82c923d77ed7450460e8a4b9
2012-03-13 19:37:16 +09:00
Jean Chalard 674ffcdf93 Make an add into a set.
This method now only sets words, so it should be named set.
The functionality is identical since there are no more places
where the list is reused.
This will also allow to make the list final in an upcoming change.

Change-Id: I25b0c7d7f13c3fa5d89806f01f48f1026769603f
2012-03-13 19:07:42 +09:00
Jean Chalard d6662ecd30 Cleanup
Remove an unused method, make others static, fix a formatting
issue

Change-Id: I40cb0b5e01a6f8e2f7b953bd9aad3168dfee71d1
2012-03-13 18:34:19 +09:00
Jean Chalard adf218eed5 Kill the StringBuilderPool.
The intention may have been nice originally but these end up
being copied anyway :/
Let's remove them now, and in a later change, just keep
references to the created objects.

Change-Id: Ifba8357c20384f9eb40cd916665ed1fc6dc8cab1
2012-03-13 17:59:49 +09:00
Jean Chalard d0d4074392 Remove a useless parameter.
Change-Id: I7625bf17158c207ad7e8cd496bef825704173c4c
2012-03-13 15:34:06 +09:00
Jean Chalard c3c4ed91cf Consolidate words into SuggestedWordInfo
We can't get rid of SuggestedWordInfo because it conveys
the information about whether a suggestion is outdated or
not. It is always created anyway. So it makes sense not
to have separate lists and to just keep everything in the
SuggestedWordInfo object.

Change-Id: Idd79dc267d97633901d3d2869da457736963e178
2012-03-12 18:58:20 +09:00
Jean Chalard 682c2d53cc Make access to the safety net calculation easier
Change-Id: If33897b38af94ae81b05e5ef140a542724b9f34a
2012-03-09 21:44:40 +09:00
Jean Chalard 151d5cb532 Extract a condition from a method
Change-Id: I6b0262fe7cb3f7a31cc19d724c301467be932640
2012-03-09 21:37:44 +09:00
Jean Chalard 36c1b37914 Remove a useless argument
Change-Id: I713433a3225193489fad5bdafcf302b529903116
2012-03-09 21:24:47 +09:00
Jean Chalard 28e59b98c6 Remove a useless escape
Change-Id: I1ef0685cc9888c9cef9f60015d32b66dde75ef9b
2012-03-09 21:10:55 +09:00
Jean Chalard ed9986824e Move some auto-correction logic to where it belongs
Change-Id: I897c5ec3a630a4a6bfc593906df4d3fc7b244482
2012-03-09 20:45:37 +09:00
Jean Chalard 0cf422fbb7 Reduction, step 8
Change-Id: I54334039597e235e24f169e34c1d44109180ee88
2012-03-09 19:00:29 +09:00
Jean Chalard a333ff19ef Reduction, step 7
Change-Id: I177ef2f29c8b6000c5e3d021c016c5d216fe3fc6
2012-03-09 18:59:20 +09:00
Jean Chalard a3ee019331 Reduction, step 6
Change-Id: I22ad4cea0e0cac23813da7e788f5c94974ce0ebf
2012-03-09 18:58:01 +09:00
Jean Chalard dbd140504d Reduction, step 5
Change-Id: Iac52e62c2bdffad14f916f69eade2b785bb41767
2012-03-09 18:44:23 +09:00