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