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
ad290d65
Commit
ad290d65
authored
13 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Activate bigram predictions from the binary dictionary
Change-Id: If1cc50539d7677b854b1cd3bea3423c8c0865de5
parent
05f09b6d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/latin/BinaryDictionary.java
+6
-9
6 additions, 9 deletions
java/src/com/android/inputmethod/latin/BinaryDictionary.java
native/src/bigram_dictionary.cpp
+2
-1
2 additions, 1 deletion
native/src/bigram_dictionary.cpp
with
8 additions
and
10 deletions
java/src/com/android/inputmethod/latin/BinaryDictionary.java
+
6
−
9
View file @
ad290d65
...
...
@@ -139,22 +139,19 @@ public class BinaryDictionary extends Dictionary {
Arrays
.
fill
(
mBigramScores
,
0
);
int
codesSize
=
codes
.
size
();
if
(
codesSize
<=
0
)
{
// Do not return bigrams from BinaryDictionary when nothing was typed.
// Only use user-history bigrams (or whatever other bigram dictionaries decide).
return
;
}
Arrays
.
fill
(
mInputCodes
,
-
1
);
int
[]
alternatives
=
codes
.
getCodesAt
(
0
);
System
.
arraycopy
(
alternatives
,
0
,
mInputCodes
,
0
,
Math
.
min
(
alternatives
.
length
,
MAX_PROXIMITY_CHARS_SIZE
));
if
(
codesSize
>
0
)
{
int
[]
alternatives
=
codes
.
getCodesAt
(
0
);
System
.
arraycopy
(
alternatives
,
0
,
mInputCodes
,
0
,
Math
.
min
(
alternatives
.
length
,
MAX_PROXIMITY_CHARS_SIZE
));
}
int
count
=
getBigramsNative
(
mNativeDict
,
chars
,
chars
.
length
,
mInputCodes
,
codesSize
,
mOutputChars_bigrams
,
mBigramScores
,
MAX_WORD_LENGTH
,
MAX_BIGRAMS
,
MAX_PROXIMITY_CHARS_SIZE
);
for
(
int
j
=
0
;
j
<
count
;
++
j
)
{
if
(
mBigramScores
[
j
]
<
1
)
break
;
if
(
codesSize
>
0
&&
mBigramScores
[
j
]
<
1
)
break
;
final
int
start
=
j
*
MAX_WORD_LENGTH
;
int
len
=
0
;
while
(
len
<
MAX_WORD_LENGTH
&&
mOutputChars_bigrams
[
start
+
len
]
!=
0
)
{
...
...
This diff is collapsed.
Click to expand it.
native/src/bigram_dictionary.cpp
+
2
−
1
View file @
ad290d65
...
...
@@ -134,7 +134,8 @@ int BigramDictionary::getBigrams(unsigned short *prevWord, int prevWordLength, i
const
int
length
=
BinaryFormat
::
getWordAtAddress
(
root
,
bigramPos
,
MAX_WORD_LENGTH
,
bigramBuffer
);
if
(
checkFirstCharacter
(
bigramBuffer
))
{
// codesSize == 0 means we are trying to find bigram predictions.
if
(
codesSize
<
1
||
checkFirstCharacter
(
bigramBuffer
))
{
const
int
frequency
=
UnigramDictionary
::
MASK_ATTRIBUTE_FREQUENCY
&
bigramFlags
;
addWordBigram
(
bigramBuffer
,
length
,
frequency
);
}
...
...
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