If not composing a word, then consideredWord is always the empty
string.
Hence, it's never whitelisted, but it's also always "NotAWord",
so isWhitelistedOrNotAWord returns always true, so
allowsToBeAutoCorrected is always true. Which means that
isPrediction implies allowsToBeAutoCorrected == true.
Thus, !isPrediction && !allowsToBeAutoCorrected is strictly
equivalent to !allowsToBeAutocorrected.
Change-Id: I4ad7a7c3447851c539646d97cf55ff065e6ee115
If we are not composing a word, that isFirstCharCapitalized
and isAllUpperCase are guaranteed to return false.
Change-Id: Ic4a0be9574acf4653c729a9594f963f5bcf0c757
The fact that prediction does not accept a null argument is an
implementation detail, it should not be visible to Java code.
Change-Id: I3a156b323b6db9353de898d33f3f7c81751cecb1
- separate ResearchLog from ResearchLogger
- fix abort menu to explicitly indicate re-enabling of logging
- auto flush entries every 5s
- conform to new suggestedWords class
multi-project change with I9fe1f8fe59d5891daa4ca84af157f36fb1bb17dc
Bug: 6188932
Change-Id: I7e99390f934481c6ed9cea2b259944583edda5bb
Use the word the same way for suggestion and prediction. It makes
little logical sense that the trailing single quotes be removed
for suggestion lookup but not for prediction lookup.
Change-Id: I0de4b5f7c5b4c1b4ba1817ff9653d7c03967146d
Avoid special casing the whitelist dictionary by having it implement
the interface it pretends it implements
Change-Id: I8b873cb0f3fe13cefd32c8cb756a25c8ae16a2b4
The user history dictionary should be the one knowing it does not suggest words
beyond 2 characters, not Suggest.
Change-Id: Ie85ec6116eb495e0c7f51108e4620c5ae536f4bf
Many methods were public but could have been private: change them
to private. Also, add a comment above public methods that don't
come from the IMF to make it clearer why they are necessary.
Change-Id: I574154b015d09c0f8542b81763f497691afdc3c1
If !mWordComposer.isComposingWord(), then mWordComposer.getTypedWord()
will always return an empty string.
Change-Id: Ife66d0abc44c743cbc30d31724e833cda168fd5c
This is not exactly the same logically speaking, because it's
theoretically possible that the composing state changed in between
the message enqueueing and it's retrieval. However in the practice,
if the composing state changed the message *must* have been
cancelled and resent, else the behavior breaks. So this actually
is more robust, and removes some obscure requirements on the
calling code.
In the practice, it should also make the cancelUpdateSuggestionStrip
message useless, although this change does not yet remove it.
Change-Id: I75141920ce64e38e2f92e9c02b6c979936eee9a9
We just resetted the composing state - updating suggestions
is sure to yield no results. We may as well not call
updateSuggestions at all.
We should however still cancel any lingering timer from a
previous input field, to avoid this useless processing.
Change-Id: Ic1a19d577903d792bb797c837cc517ea8d430e75
If the separator is not a space, then we will always call
setPunctuationSuggestions and reset the suggestion strip anyway.
If the separator is a space, then the cursor has a space on
the left, which means isCursorTouchingWord depends only on
whether it touches a word on the right. If we were displaying
the "add to dictionary hint", it means a suggestion was just
chosen, so it had to be displayed, and that requires a composing
word and no non-separator at the right of the cursor.
In the end, if we go through this postUpdateSuggestions call,
we are sure we will reset the suggestions later in this method,
either by calling postUpdateBigramPredictions, or
setPunctuationSuggestions.
Change-Id: I95d5f77a5d0ac6d1a6ced8d67d6ac8f650db4a32
Just after this, clear() will be called, removing the suggestion
strip from the screen. It will later be displayed again through
onStartInputView, which will update its content.
Change-Id: I15c23ad2adecab76b0791d7fc222d15b6533f3bd
The responsivity is better like this. This does not seem to
feel slow as the previous comment seemed to indicate.
Also remove a stale comment.
Change-Id: I4e7bf9fe28716e112db182e44b3fa88ee4526bb4
After reverting an auto-correct we always have a separator after
the previously inserted word, and the cursor is never touching
a word. Showing predictions is the right thing to do, while
calling postUpdateSuggestions will invariably yield an invariably
blank suggestion strip, which is not very helpful.
Likewise, after we pick a suggestion, we should be showing the
predictions unless showing the addToDictionary hint. There was
a bug here in the corner case that the word would be a candidate
for user dictionary, but the user dictionary provider is not
available: in this case we should be showing predictions, but
we were showing an unhelpful empty suggestion bar.
Change-Id: I287bb5eb4af762bd5a433e85e185fab6d203e91a
If suggestion and prediction messages both happen to be in
the queue, the latest one will win (update the suggestion strip
later than the other, overwriting any previous suggestions).
So when we enqueue either one, it is always safe to cancel
all messages of both types.
Change-Id: Iad9dd06d08c49f60cac16b88edcc9531a18ec02e
It's simpler to check the safety net directly inside the
function that checks for auto-correction threshold.
This introduces one very slight change in behavior. The value
checked by the safety net is not any more the "typed word" but the
"considered word", the difference being any possibly appended
single quotes.
E.g. the user types "this'''" : the typed word is "this'''" but
the considered word is "this".
This change in behavior can be considered a bugfix.
Change-Id: Ia7ab4bc933183dfbd41bb00328e4c0b5ab76bc63
We internally use the string "zz" to mean no locale, but
the user dictionary service does not understand that and
words added with this locale pitifully end being added to
a "zz" user dictionary, which makes no sense to the user.
This change fixes things so that words added when the
keyboard is in a "no locale" layout, the words are added
to the global, all-locales user dictionary.
Bug: 6645306
Change-Id: Iec3cdd1fe3d5bc43427a43ef9ae9bf89e12be1f2
If allowsAutoCorrected is false, there is no point in making
hasAutoCorrection true, since in the only place where we use
it again, it's &&'ed with allowsAutoCorrected !
Well that was extremely obscure, good thing refactoring allowed
to realize this was useless >.>
Change-Id: I34936d445f1ced17c7bd04a9524bf608f9e8b9c8
The test against hasMainDictionary is a test to know if we should
auto-correct or not. Its result should be recorded in
hasAutoCorrection, not in allowsToBeAutoCorrected.
Actually, this value being inserted in allowsToBeAutoCorrected was
causing a bug that nobody noticed: when typing in a language with
no dictionary, the word in the middle of the suggestion strip would
always be bold, as if it was going to auto-correct to itself !
This change fixes this bug.
Change-Id: Ia1f08efd7089b9c5cbede910c5b0951d83e698d2
- English : some words caught through regression tests
- English : some words externally reported
- French : some words externally reported
- French : finished review of all accented words
Bug: 6726969
Bug: 6730031
Change-Id: I37d0dc310db2c79e03ac7ad452391e92d9b13357
The goal here is to disambiguate TypedWordValid and
HasAutoCorrectionCandidate. Ultimately, HasAutoCorrectionCandidate
will disappear.
Bug: 6705473
Change-Id: I1acbd0a5efc7f4bf7b0bdb12839fe3d84e9d1dda
TypedWordValid and AllowsToBeAutoCorrected are almost the
same thing; the difference is whether the word is also a
whitelist entry or not. In this case, TypedWordValid was
the right one to test.
Change-Id: I695fe5b9f6bbe9d3ba314c646da3a25742c9f4ed
isWhitelistedOrNotAWord takes an 'ignoreCase' argument. By looking
at the contents of the wordcomposer here, there is only one case
where its output will be different : when the word is typed with a
capital, but the lower case version exists in the dictionary.
E.g. the user typed "This".
In this case, isWhitelistedOrNotAWord in line 235 will return false
instead of true, so the test will score a true instead of a false,
so hasAutoCorrection may be true instead of false in this specific
case and that's the only case where it's different.
But in this case, allowsToBeAutoCorrected is certain to be false,
which means the result will not have changed if hasAutoCorrection
was true in the first place. So in the end this change is sure not
to change the behavior.
Change-Id: Ic41cf959c20c19165f84d9b8ff006731fa595d84
There is no reason to prevent 1-letter words to auto-correct
to themselves, or to dictionary words. Don't do it.
Change-Id: Iceada847ae632336026ada29afed0353cd9c51b5
If a word is a dictionary word but still has no suggestion,
this method should return true. In the practice, it makes
no difference since a word without suggestion won't be changed
anyway.
Change-Id: Ib1f5ef254b7da7e5cedb2f973529ad431beb93f9
allowsToBeAutoCorrected always returns false if the word is empty.
This is because the whitelist never contains an empty string,
and isValidWord returns false if the word is empty.
Change-Id: I34ecc2a1563aea6db5b2f12796f251f6598576a2