Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
64dad2d5
Commit
64dad2d5
authored
12 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Remove an unused method and inline another (A10)
Change-Id: Ifd71ce79711b0c15c7764e97351dbb1b8e4c0c2d
parent
d522ddef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/latin/Suggest.java
+10
-43
10 additions, 43 deletions
java/src/com/android/inputmethod/latin/Suggest.java
with
10 additions
and
43 deletions
java/src/com/android/inputmethod/latin/Suggest.java
+
10
−
43
View file @
64dad2d5
...
@@ -209,31 +209,6 @@ public class Suggest implements Dictionary.WordCallback {
...
@@ -209,31 +209,6 @@ public class Suggest implements Dictionary.WordCallback {
return
sb
;
return
sb
;
}
}
private
static
final
WordComposer
sEmptyWordComposer
=
new
WordComposer
();
public
SuggestedWords
getBigramPredictions
(
CharSequence
prevWordForBigram
)
{
LatinImeLogger
.
onStartSuggestion
(
prevWordForBigram
);
mIsFirstCharCapitalized
=
false
;
mIsAllUpperCase
=
false
;
mTrailingSingleQuotesCount
=
0
;
mSuggestions
=
new
ArrayList
<
SuggestedWordInfo
>(
MAX_SUGGESTIONS
);
// Treating USER_TYPED as UNIGRAM suggestion for logging now.
LatinImeLogger
.
onAddSuggestedWord
(
""
,
Suggest
.
DIC_USER_TYPED
,
Dictionary
.
UNIGRAM
);
mConsideredWord
=
""
;
getAllBigrams
(
prevWordForBigram
,
sEmptyWordComposer
);
SuggestedWordInfo
.
removeDups
(
mSuggestions
);
return
new
SuggestedWords
(
mSuggestions
,
false
/* typedWordValid */
,
false
/* hasAutoCorrectionCandidate */
,
false
/* allowsToBeAutoCorrected */
,
false
/* isPunctuationSuggestions */
,
false
/* isObsoleteSuggestions */
,
true
/* isPrediction */
);
}
// Compatibility for tests. TODO: remove this
// Compatibility for tests. TODO: remove this
public
SuggestedWords
getSuggestedWords
(
public
SuggestedWords
getSuggestedWords
(
final
WordComposer
wordComposer
,
CharSequence
prevWordForBigram
,
final
WordComposer
wordComposer
,
CharSequence
prevWordForBigram
,
...
@@ -264,7 +239,16 @@ public class Suggest implements Dictionary.WordCallback {
...
@@ -264,7 +239,16 @@ public class Suggest implements Dictionary.WordCallback {
if
(
wordComposer
.
size
()
<=
1
&&
isCorrectionEnabled
)
{
if
(
wordComposer
.
size
()
<=
1
&&
isCorrectionEnabled
)
{
// At first character typed, search only the bigrams
// At first character typed, search only the bigrams
if
(!
TextUtils
.
isEmpty
(
prevWordForBigram
))
{
if
(!
TextUtils
.
isEmpty
(
prevWordForBigram
))
{
getAllBigrams
(
prevWordForBigram
,
wordComposer
);
if
(
StringUtils
.
hasUpperCase
(
prevWordForBigram
))
{
// TODO: Must pay attention to locale when changing case.
final
CharSequence
lowerPrevWord
=
prevWordForBigram
.
toString
().
toLowerCase
();
for
(
final
Dictionary
dictionary
:
mBigramDictionaries
.
values
())
{
dictionary
.
getBigrams
(
wordComposer
,
lowerPrevWord
,
this
);
}
}
for
(
final
Dictionary
dictionary
:
mBigramDictionaries
.
values
())
{
dictionary
.
getBigrams
(
wordComposer
,
prevWordForBigram
,
this
);
}
}
}
}
else
if
(
wordComposer
.
size
()
>
1
)
{
}
else
if
(
wordComposer
.
size
()
>
1
)
{
final
WordComposer
wordComposerForLookup
;
final
WordComposer
wordComposerForLookup
;
...
@@ -362,23 +346,6 @@ public class Suggest implements Dictionary.WordCallback {
...
@@ -362,23 +346,6 @@ public class Suggest implements Dictionary.WordCallback {
isPrediction
);
isPrediction
);
}
}
/**
* Adds all bigram predictions for prevWord. Also checks the lower case version of prevWord if
* it contains any upper case characters.
*/
private
void
getAllBigrams
(
final
CharSequence
prevWord
,
final
WordComposer
wordComposer
)
{
if
(
StringUtils
.
hasUpperCase
(
prevWord
))
{
// TODO: Must pay attention to locale when changing case.
final
CharSequence
lowerPrevWord
=
prevWord
.
toString
().
toLowerCase
();
for
(
final
Dictionary
dictionary
:
mBigramDictionaries
.
values
())
{
dictionary
.
getBigrams
(
wordComposer
,
lowerPrevWord
,
this
);
}
}
for
(
final
Dictionary
dictionary
:
mBigramDictionaries
.
values
())
{
dictionary
.
getBigrams
(
wordComposer
,
prevWord
,
this
);
}
}
private
static
ArrayList
<
SuggestedWordInfo
>
getSuggestionsInfoListWithDebugInfo
(
private
static
ArrayList
<
SuggestedWordInfo
>
getSuggestionsInfoListWithDebugInfo
(
final
String
typedWord
,
final
ArrayList
<
SuggestedWordInfo
>
suggestions
)
{
final
String
typedWord
,
final
ArrayList
<
SuggestedWordInfo
>
suggestions
)
{
final
SuggestedWordInfo
typedWordInfo
=
suggestions
.
get
(
0
);
final
SuggestedWordInfo
typedWordInfo
=
suggestions
.
get
(
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment