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
089c11a0
Commit
089c11a0
authored
12 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup
Change-Id: I575f22330bf6881af1d9a35f22b51b7bf2198113
parent
d05d1d04
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
+8
-17
8 additions, 17 deletions
java/src/com/android/inputmethod/latin/Suggest.java
with
8 additions
and
17 deletions
java/src/com/android/inputmethod/latin/Suggest.java
+
8
−
17
View file @
089c11a0
...
...
@@ -231,7 +231,7 @@ public class Suggest {
localSuggestions
.
addAll
(
dictionary
.
getBigrams
(
wordComposer
,
lowerPrevWord
));
}
for
(
final
SuggestedWordInfo
localSuggestion
:
localSuggestions
)
{
addWord
(
localSuggestion
,
key
,
suggestionsContainer
,
consideredWord
);
addWord
(
localSuggestion
,
key
,
suggestionsContainer
);
}
}
}
...
...
@@ -254,7 +254,7 @@ public class Suggest {
final
ArrayList
<
SuggestedWordInfo
>
localSuggestions
=
dictionary
.
getWords
(
wordComposerForLookup
,
prevWordForBigram
,
proximityInfo
);
for
(
final
SuggestedWordInfo
suggestion
:
localSuggestions
)
{
addWord
(
suggestion
,
key
,
suggestionsContainer
,
consideredWord
);
addWord
(
suggestion
,
key
,
suggestionsContainer
);
}
}
}
...
...
@@ -376,31 +376,22 @@ public class Suggest {
private
static
final
SuggestedWordInfoComparator
sSuggestedWordInfoComparator
=
new
SuggestedWordInfoComparator
();
public
boolean
addWord
(
final
SuggestedWordInfo
wordInfo
,
final
String
dictTypeKey
,
final
ArrayList
<
SuggestedWordInfo
>
suggestions
,
final
String
consideredWord
)
{
final
int
prefMaxSuggestions
=
MAX_SUGGESTIONS
;
final
CharSequence
word
=
wordInfo
.
mWord
;
final
int
score
=
wordInfo
.
mScore
;
int
pos
=
0
;
public
void
addWord
(
final
SuggestedWordInfo
wordInfo
,
final
String
dictTypeKey
,
final
ArrayList
<
SuggestedWordInfo
>
suggestions
)
{
final
int
index
=
Collections
.
binarySearch
(
suggestions
,
wordInfo
,
sSuggestedWordInfoComparator
);
// binarySearch returns the index of an equal word info if found. If not found
// it returns -insertionPoint - 1. We want the insertion point, so:
pos
=
index
>=
0
?
index
:
-
index
-
1
;
if
(
pos
>=
prefMaxSuggestions
)
{
return
true
;
}
final
int
pos
=
index
>=
0
?
index
:
-
index
-
1
;
if
(
pos
>=
MAX_SUGGESTIONS
)
return
;
final
SuggestedWordInfo
transformedWordInfo
=
getTransformedSuggestedWordInfo
(
wordInfo
,
mLocale
,
mIsAllUpperCase
,
mIsFirstCharCapitalized
,
mTrailingSingleQuotesCount
);
suggestions
.
add
(
pos
,
transformedWordInfo
);
if
(
suggestions
.
size
()
>
prefMaxSuggestions
)
{
suggestions
.
remove
(
prefMaxSuggestions
);
if
(
suggestions
.
size
()
>
MAX_SUGGESTIONS
)
{
suggestions
.
remove
(
MAX_SUGGESTIONS
);
}
LatinImeLogger
.
onAddSuggestedWord
(
transformedWordInfo
.
mWord
.
toString
(),
dictTypeKey
);
return
true
;
}
private
static
SuggestedWordInfo
getTransformedSuggestedWordInfo
(
...
...
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