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
e58f3af8
Commit
e58f3af8
authored
12 years ago
by
satok
Browse files
Options
Downloads
Patches
Plain Diff
Treat apostrophe as single quote in spell checker
Bug: 6435348 Change-Id: Iaaac9042e7e6cb21a3f2243bc6e8e055cc24f74d
parent
8950ce6c
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/spellcheck/AndroidSpellCheckerService.java
+9
-6
9 additions, 6 deletions
...utmethod/latin/spellcheck/AndroidSpellCheckerService.java
with
9 additions
and
6 deletions
java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+
9
−
6
View file @
e58f3af8
...
@@ -90,6 +90,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
...
@@ -90,6 +90,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
public
static
final
int
SCRIPT_LATIN
=
0
;
public
static
final
int
SCRIPT_LATIN
=
0
;
public
static
final
int
SCRIPT_CYRILLIC
=
1
;
public
static
final
int
SCRIPT_CYRILLIC
=
1
;
private
static
final
String
SINGLE_QUOTE
=
"\u0027"
;
private
static
final
String
APOSTROPHE
=
"\u2019"
;
private
static
final
TreeMap
<
String
,
Integer
>
mLanguageToScript
;
private
static
final
TreeMap
<
String
,
Integer
>
mLanguageToScript
;
static
{
static
{
// List of the supported languages and their associated script. We won't check
// List of the supported languages and their associated script. We won't check
...
@@ -574,24 +576,24 @@ public class AndroidSpellCheckerService extends SpellCheckerService
...
@@ -574,24 +576,24 @@ public class AndroidSpellCheckerService extends SpellCheckerService
public
SuggestionsInfo
onGetSuggestions
(
final
TextInfo
textInfo
,
public
SuggestionsInfo
onGetSuggestions
(
final
TextInfo
textInfo
,
final
int
suggestionsLimit
)
{
final
int
suggestionsLimit
)
{
try
{
try
{
final
String
t
ext
=
textInfo
.
getText
();
final
String
inT
ext
=
textInfo
.
getText
();
final
SuggestionsParams
cachedSuggestionsParams
=
final
SuggestionsParams
cachedSuggestionsParams
=
mSuggestionsCache
.
getSuggestionsFromCache
(
t
ext
);
mSuggestionsCache
.
getSuggestionsFromCache
(
inT
ext
);
if
(
cachedSuggestionsParams
!=
null
)
{
if
(
cachedSuggestionsParams
!=
null
)
{
if
(
DBG
)
{
if
(
DBG
)
{
Log
.
d
(
TAG
,
"Cache hit: "
+
t
ext
+
", "
+
cachedSuggestionsParams
.
mFlags
);
Log
.
d
(
TAG
,
"Cache hit: "
+
inT
ext
+
", "
+
cachedSuggestionsParams
.
mFlags
);
}
}
return
new
SuggestionsInfo
(
return
new
SuggestionsInfo
(
cachedSuggestionsParams
.
mFlags
,
cachedSuggestionsParams
.
mSuggestions
);
cachedSuggestionsParams
.
mFlags
,
cachedSuggestionsParams
.
mSuggestions
);
}
}
if
(
shouldFilterOut
(
t
ext
,
mScript
))
{
if
(
shouldFilterOut
(
inT
ext
,
mScript
))
{
DictAndProximity
dictInfo
=
null
;
DictAndProximity
dictInfo
=
null
;
try
{
try
{
dictInfo
=
mDictionaryPool
.
takeOrGetNull
();
dictInfo
=
mDictionaryPool
.
takeOrGetNull
();
if
(
null
==
dictInfo
)
return
getNotInDictEmptySuggestions
();
if
(
null
==
dictInfo
)
return
getNotInDictEmptySuggestions
();
return
dictInfo
.
mDictionary
.
isValidWord
(
t
ext
)
?
getInDictEmptySuggestions
()
return
dictInfo
.
mDictionary
.
isValidWord
(
inT
ext
)
?
:
getNotInDictEmptySuggestions
();
getInDictEmptySuggestions
()
:
getNotInDictEmptySuggestions
();
}
finally
{
}
finally
{
if
(
null
!=
dictInfo
)
{
if
(
null
!=
dictInfo
)
{
if
(!
mDictionaryPool
.
offer
(
dictInfo
))
{
if
(!
mDictionaryPool
.
offer
(
dictInfo
))
{
...
@@ -600,6 +602,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
...
@@ -600,6 +602,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
}
}
}
}
}
}
final
String
text
=
inText
.
replaceAll
(
APOSTROPHE
,
SINGLE_QUOTE
);
// TODO: Don't gather suggestions if the limit is <= 0 unless necessary
// TODO: Don't gather suggestions if the limit is <= 0 unless necessary
final
SuggestionsGatherer
suggestionsGatherer
=
new
SuggestionsGatherer
(
text
,
final
SuggestionsGatherer
suggestionsGatherer
=
new
SuggestionsGatherer
(
text
,
...
...
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