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
473a3dd6
Commit
473a3dd6
authored
12 years ago
by
Ken Wakasa
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Just cosmetic changes in jni code"
parents
c4092d8e
db87fe4d
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
native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+10
-22
10 additions, 22 deletions
...ve/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
with
10 additions
and
22 deletions
native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+
10
−
22
View file @
473a3dd6
...
...
@@ -132,23 +132,18 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
Dictionary
*
dictionary
=
(
Dictionary
*
)
dict
;
if
(
!
dictionary
)
return
0
;
ProximityInfo
*
pInfo
=
(
ProximityInfo
*
)
proximityInfo
;
int
*
xCoordinates
=
env
->
GetIntArrayElements
(
xCoordinatesArray
,
0
);
int
*
yCoordinates
=
env
->
GetIntArrayElements
(
yCoordinatesArray
,
0
);
int
*
frequencies
=
env
->
GetIntArrayElements
(
frequencyArray
,
0
);
int
*
inputCodes
=
env
->
GetIntArrayElements
(
inputArray
,
0
);
jchar
*
outputChars
=
env
->
GetCharArrayElements
(
outputArray
,
0
);
int
count
=
dictionary
->
getSuggestions
(
pInfo
,
xCoordinates
,
yCoordinates
,
inputCodes
,
arraySize
,
useFullEditDistance
,
(
unsigned
short
*
)
outputChars
,
frequencies
);
env
->
ReleaseIntArrayElements
(
frequencyArray
,
frequencies
,
0
);
env
->
ReleaseCharArrayElements
(
outputArray
,
outputChars
,
0
);
env
->
ReleaseIntArrayElements
(
inputArray
,
inputCodes
,
JNI_ABORT
);
env
->
ReleaseIntArrayElements
(
xCoordinatesArray
,
xCoordinat
es
,
0
);
env
->
ReleaseIntArrayElements
(
frequencyArray
,
frequenci
es
,
0
);
env
->
ReleaseIntArrayElements
(
yCoordinatesArray
,
yCoordinates
,
0
);
env
->
ReleaseCharArrayElements
(
outputArray
,
outputChars
,
0
);
env
->
ReleaseIntArrayElements
(
xCoordinatesArray
,
xCoordinates
,
0
);
return
count
;
}
...
...
@@ -157,20 +152,16 @@ static int latinime_BinaryDictionary_getBigrams(JNIEnv *env, jobject object, jlo
jcharArray
outputArray
,
jintArray
frequencyArray
,
jint
maxWordLength
,
jint
maxBigrams
)
{
Dictionary
*
dictionary
=
(
Dictionary
*
)
dict
;
if
(
!
dictionary
)
return
0
;
jchar
*
prevWord
=
env
->
GetCharArrayElements
(
prevWordArray
,
0
);
int
*
inputCodes
=
env
->
GetIntArrayElements
(
inputArray
,
0
);
jchar
*
outputChars
=
env
->
GetCharArrayElements
(
outputArray
,
0
);
int
*
frequencies
=
env
->
GetIntArrayElements
(
frequencyArray
,
0
);
int
count
=
dictionary
->
getBigrams
((
unsigned
short
*
)
prevWord
,
prevWordLength
,
inputCodes
,
inputArraySize
,
(
unsigned
short
*
)
outputChars
,
frequencies
,
maxWordLength
,
maxBigrams
);
env
->
ReleaseCharArrayElements
(
prevWordArray
,
prevWord
,
JNI_ABORT
);
env
->
ReleaseIntArrayElements
(
inputArray
,
inputCodes
,
JNI_ABORT
);
env
->
ReleaseCharArrayElements
(
outputArray
,
outputChars
,
0
);
env
->
ReleaseIntArrayElements
(
frequencyArray
,
frequencies
,
0
);
env
->
ReleaseCharArrayElements
(
outputArray
,
outputChars
,
0
);
env
->
ReleaseIntArrayElements
(
inputArray
,
inputCodes
,
JNI_ABORT
);
env
->
ReleaseCharArrayElements
(
prevWordArray
,
prevWord
,
JNI_ABORT
);
return
count
;
}
...
...
@@ -178,11 +169,9 @@ static jboolean latinime_BinaryDictionary_isValidWord(JNIEnv *env, jobject objec
jcharArray
wordArray
,
jint
wordLength
)
{
Dictionary
*
dictionary
=
(
Dictionary
*
)
dict
;
if
(
!
dictionary
)
return
(
jboolean
)
false
;
jchar
*
word
=
env
->
GetCharArrayElements
(
wordArray
,
0
);
jboolean
result
=
dictionary
->
isValidWord
((
unsigned
short
*
)
word
,
wordLength
);
env
->
ReleaseCharArrayElements
(
wordArray
,
word
,
JNI_ABORT
);
return
result
;
}
...
...
@@ -190,11 +179,10 @@ static jdouble latinime_BinaryDictionary_calcNormalizedScore(JNIEnv *env, jobjec
jcharArray
before
,
jint
beforeLength
,
jcharArray
after
,
jint
afterLength
,
jint
score
)
{
jchar
*
beforeChars
=
env
->
GetCharArrayElements
(
before
,
0
);
jchar
*
afterChars
=
env
->
GetCharArrayElements
(
after
,
0
);
jdouble
result
=
Correction
::
RankingAlgorithm
::
calcNormalizedScore
(
(
unsigned
short
*
)
beforeChars
,
beforeLength
,
(
unsigned
short
*
)
afterChars
,
afterLength
,
score
);
env
->
ReleaseCharArrayElements
(
before
,
beforeChars
,
JNI_ABORT
);
jdouble
result
=
Correction
::
RankingAlgorithm
::
calcNormalizedScore
((
unsigned
short
*
)
beforeChars
,
beforeLength
,
(
unsigned
short
*
)
afterChars
,
afterLength
,
score
);
env
->
ReleaseCharArrayElements
(
after
,
afterChars
,
JNI_ABORT
);
env
->
ReleaseCharArrayElements
(
before
,
beforeChars
,
JNI_ABORT
);
return
result
;
}
...
...
@@ -204,8 +192,8 @@ static jint latinime_BinaryDictionary_editDistance(JNIEnv *env, jobject object,
jchar
*
afterChars
=
env
->
GetCharArrayElements
(
after
,
0
);
jint
result
=
Correction
::
RankingAlgorithm
::
editDistance
(
(
unsigned
short
*
)
beforeChars
,
beforeLength
,
(
unsigned
short
*
)
afterChars
,
afterLength
);
env
->
ReleaseCharArrayElements
(
before
,
beforeChars
,
JNI_ABORT
);
env
->
ReleaseCharArrayElements
(
after
,
afterChars
,
JNI_ABORT
);
env
->
ReleaseCharArrayElements
(
before
,
beforeChars
,
JNI_ABORT
);
return
result
;
}
...
...
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