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
707b903c
Commit
707b903c
authored
2 weeks ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Update dictionary group locale weights
parent
4a9721ab
Branches
model-metadata
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/org/futo/inputmethod/latin/DictionaryFacilitatorImpl.java
+22
-2
22 additions, 2 deletions
...org/futo/inputmethod/latin/DictionaryFacilitatorImpl.java
with
22 additions
and
2 deletions
java/src/org/futo/inputmethod/latin/DictionaryFacilitatorImpl.java
+
22
−
2
View file @
707b903c
...
...
@@ -138,8 +138,8 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
// TODO: Run evaluation to determine a reasonable value for these constants. The current
// values are ad-hoc and chosen without any particular care or methodology.
public
static
final
float
WEIGHT_FOR_MOST_PROBABLE_LANGUAGE
=
1.0f
;
public
static
final
float
WEIGHT_FOR_GESTURING_IN_NOT_MOST_PROBABLE_LANGUAGE
=
0.
95
f
;
public
static
final
float
WEIGHT_FOR_TYPING_IN_NOT_MOST_PROBABLE_LANGUAGE
=
0.
6
f
;
public
static
final
float
WEIGHT_FOR_GESTURING_IN_NOT_MOST_PROBABLE_LANGUAGE
=
0.
6
f
;
public
static
final
float
WEIGHT_FOR_TYPING_IN_NOT_MOST_PROBABLE_LANGUAGE
=
0.
8
f
;
/**
* The locale associated with the dictionary group.
...
...
@@ -738,6 +738,23 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
return
codePoints
;
}
private
void
updateDictionaryGroupWeights
()
{
int
maxConfidence
=
0
;
for
(
DictionaryGroup
dictionaryGroup
:
mDictionaryGroups
)
{
if
(
dictionaryGroup
.
mConfidence
>
maxConfidence
)
maxConfidence
=
dictionaryGroup
.
mConfidence
;
}
for
(
DictionaryGroup
dictionaryGroup
:
mDictionaryGroups
)
{
if
(
dictionaryGroup
.
mConfidence
>=
maxConfidence
)
{
dictionaryGroup
.
mWeightForTypingInLocale
=
DictionaryGroup
.
WEIGHT_FOR_MOST_PROBABLE_LANGUAGE
;
dictionaryGroup
.
mWeightForGesturingInLocale
=
DictionaryGroup
.
WEIGHT_FOR_MOST_PROBABLE_LANGUAGE
;
}
else
{
dictionaryGroup
.
mWeightForTypingInLocale
=
DictionaryGroup
.
WEIGHT_FOR_TYPING_IN_NOT_MOST_PROBABLE_LANGUAGE
;
dictionaryGroup
.
mWeightForGesturingInLocale
=
DictionaryGroup
.
WEIGHT_FOR_GESTURING_IN_NOT_MOST_PROBABLE_LANGUAGE
;
}
}
}
// TODO: Revise the way to fusion suggestion results.
@Override
@Nonnull
public
SuggestionResults
getSuggestionResults
(
ComposedData
composedData
,
...
...
@@ -750,6 +767,9 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
false
/* firstSuggestionExceedsConfidenceThreshold */
);
final
float
[]
weightOfLangModelVsSpatialModel
=
new
float
[]
{
Dictionary
.
NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL
};
updateDictionaryGroupWeights
();
for
(
DictionaryGroup
dictionaryGroup
:
mDictionaryGroups
)
{
for
(
final
String
dictType
:
ALL_DICTIONARY_TYPES
)
{
final
Dictionary
dictionary
=
dictionaryGroup
.
getDict
(
dictType
);
...
...
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