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
61c1002b
Commit
61c1002b
authored
12 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Refactor and squash long-standing bugs (A2)"
parents
abf81192
9433ce86
No related branches found
No related tags found
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
+9
-13
9 additions, 13 deletions
java/src/com/android/inputmethod/latin/Suggest.java
with
9 additions
and
13 deletions
java/src/com/android/inputmethod/latin/Suggest.java
+
9
−
13
View file @
61c1002b
...
@@ -252,7 +252,7 @@ public class Suggest {
...
@@ -252,7 +252,7 @@ public class Suggest {
}
}
for
(
final
SuggestedWordInfo
suggestion
:
localSuggestions
)
{
for
(
final
SuggestedWordInfo
suggestion
:
localSuggestions
)
{
final
String
suggestionStr
=
suggestion
.
mWord
.
toString
();
final
String
suggestionStr
=
suggestion
.
mWord
.
toString
();
addWord
(
suggestionStr
.
toCharArray
(),
null
,
0
,
suggestionStr
.
length
()
,
addWord
(
suggestionStr
,
null
,
suggestion
.
mScore
,
dicTypeId
,
Dictionary
.
BIGRAM
,
suggestion
.
mScore
,
dicTypeId
,
Dictionary
.
BIGRAM
,
suggestions
,
consideredWord
);
suggestions
,
consideredWord
);
}
}
...
@@ -279,7 +279,7 @@ public class Suggest {
...
@@ -279,7 +279,7 @@ public class Suggest {
wordComposerForLookup
,
prevWordForBigram
,
proximityInfo
);
wordComposerForLookup
,
prevWordForBigram
,
proximityInfo
);
for
(
final
SuggestedWordInfo
suggestion
:
localSuggestions
)
{
for
(
final
SuggestedWordInfo
suggestion
:
localSuggestions
)
{
final
String
suggestionStr
=
suggestion
.
mWord
.
toString
();
final
String
suggestionStr
=
suggestion
.
mWord
.
toString
();
addWord
(
suggestionStr
.
toCharArray
(),
null
,
0
,
suggestionStr
.
length
()
,
addWord
(
suggestionStr
,
null
,
suggestion
.
mScore
,
dicTypeId
,
Dictionary
.
UNIGRAM
,
suggestion
.
mScore
,
dicTypeId
,
Dictionary
.
UNIGRAM
,
suggestions
,
consideredWord
);
suggestions
,
consideredWord
);
}
}
...
@@ -388,17 +388,17 @@ public class Suggest {
...
@@ -388,17 +388,17 @@ public class Suggest {
return
suggestionsList
;
return
suggestionsList
;
}
}
// TODO: Use codepoint instead of char
public
boolean
addWord
(
final
String
word
,
int
[]
indices
,
public
boolean
addWord
(
final
char
[]
word
,
int
[]
indices
,
final
int
offset
,
final
int
length
,
int
score
,
final
int
dicTypeId
,
final
int
dataType
,
int
score
,
final
int
dicTypeId
,
final
int
dataType
,
final
ArrayList
<
SuggestedWordInfo
>
suggestions
,
final
String
consideredWord
)
{
final
ArrayList
<
SuggestedWordInfo
>
suggestions
,
final
String
consideredWord
)
{
int
dataTypeForLog
=
dataType
;
int
dataTypeForLog
=
dataType
;
final
int
prefMaxSuggestions
=
MAX_SUGGESTIONS
;
final
int
prefMaxSuggestions
=
MAX_SUGGESTIONS
;
final
int
length
=
word
.
codePointCount
(
0
,
word
.
length
());
int
pos
=
0
;
int
pos
=
0
;
// Check if it's the same word, only caps are different
// Check if it's the same word, only caps are different
if
(
StringUtils
.
equalsIgnoreCase
(
consideredWord
,
word
,
offset
,
length
))
{
if
(
StringUtils
.
equalsIgnoreCase
(
consideredWord
,
word
))
{
// TODO: remove this surrounding if clause and move this logic to
// TODO: remove this surrounding if clause and move this logic to
// getSuggestedWordBuilder.
// getSuggestedWordBuilder.
if
(
suggestions
.
size
()
>
0
)
{
if
(
suggestions
.
size
()
>
0
)
{
...
@@ -407,7 +407,7 @@ public class Suggest {
...
@@ -407,7 +407,7 @@ public class Suggest {
// frequency to determine the insertion position. This does not ensure strictly
// frequency to determine the insertion position. This does not ensure strictly
// correct ordering, but ensures the top score is on top which is enough for
// correct ordering, but ensures the top score is on top which is enough for
// removing duplicates correctly.
// removing duplicates correctly.
if
(
StringUtils
.
equalsIgnoreCase
(
currentHighestWord
.
mWord
,
word
,
offset
,
length
)
if
(
StringUtils
.
equalsIgnoreCase
(
currentHighestWord
.
mWord
,
word
)
&&
score
<=
currentHighestWord
.
mScore
)
{
&&
score
<=
currentHighestWord
.
mScore
)
{
pos
=
1
;
pos
=
1
;
}
}
...
@@ -430,16 +430,12 @@ public class Suggest {
...
@@ -430,16 +430,12 @@ public class Suggest {
}
}
final
StringBuilder
sb
=
new
StringBuilder
(
getApproxMaxWordLength
());
final
StringBuilder
sb
=
new
StringBuilder
(
getApproxMaxWordLength
());
// TODO: Must pay attention to locale when changing case.
if
(
mIsAllUpperCase
)
{
if
(
mIsAllUpperCase
)
{
sb
.
append
(
new
String
(
word
,
offset
,
length
)
.
toUpperCase
());
sb
.
append
(
word
.
toUpperCase
(
mLocale
));
}
else
if
(
mIsFirstCharCapitalized
)
{
}
else
if
(
mIsFirstCharCapitalized
)
{
sb
.
append
(
Character
.
toUpperCase
(
word
[
offset
]));
sb
.
append
(
StringUtils
.
toTitleCase
(
word
,
mLocale
));
if
(
length
>
1
)
{
sb
.
append
(
word
,
offset
+
1
,
length
-
1
);
}
}
else
{
}
else
{
sb
.
append
(
word
,
offset
,
length
);
sb
.
append
(
word
);
}
}
for
(
int
i
=
mTrailingSingleQuotesCount
-
1
;
i
>=
0
;
--
i
)
{
for
(
int
i
=
mTrailingSingleQuotesCount
-
1
;
i
>=
0
;
--
i
)
{
sb
.
appendCodePoint
(
Keyboard
.
CODE_SINGLE_QUOTE
);
sb
.
appendCodePoint
(
Keyboard
.
CODE_SINGLE_QUOTE
);
...
...
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