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
0d7d6b81
Commit
0d7d6b81
authored
9 months ago
by
Aleksandras Kostarevas
Browse files
Options
Downloads
Patches
Plain Diff
Skip loading LM if it has not existed once
parent
43c46da5
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/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt
+5
-1
5 additions, 1 deletion
...rg/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt
with
5 additions
and
1 deletion
java/src/org/futo/inputmethod/latin/xlm/LanguageModelFacilitator.kt
+
5
−
1
View file @
0d7d6b81
...
@@ -181,11 +181,13 @@ public class LanguageModelFacilitator(
...
@@ -181,11 +181,13 @@ public class LanguageModelFacilitator(
}
}
}
}
private
var
skipLanguage
:
String
?
=
null
private
suspend
fun
runLanguageModel
(
values
:
PredictionInputValues
):
ArrayList
<
SuggestedWordInfo
>?
{
private
suspend
fun
runLanguageModel
(
values
:
PredictionInputValues
):
ArrayList
<
SuggestedWordInfo
>?
{
if
(
transformerDisabled
)
return
null
if
(
transformerDisabled
)
return
null
val
locale
=
dictionaryFacilitator
.
locale
?:
return
null
val
locale
=
dictionaryFacilitator
.
locale
?:
return
null
if
(
languageModel
==
null
||
(
languageModel
?.
locale
?.
language
!=
locale
.
language
))
{
if
((
languageModel
==
null
&&
locale
.
language
!=
skipLanguage
)
||
(
languageModel
?.
locale
?.
language
!=
locale
.
language
))
{
skipLanguage
=
null
Log
.
d
(
Log
.
d
(
"LanguageModelFacilitator"
,
"LanguageModelFacilitator"
,
"Calling closeInternalLocked on model due to seeming locale change"
"Calling closeInternalLocked on model due to seeming locale change"
...
@@ -200,6 +202,7 @@ public class LanguageModelFacilitator(
...
@@ -200,6 +202,7 @@ public class LanguageModelFacilitator(
languageModel
=
LanguageModel
(
context
,
lifecycleScope
,
model
,
locale
)
languageModel
=
LanguageModel
(
context
,
lifecycleScope
,
model
,
locale
)
}
else
{
}
else
{
Log
.
d
(
"LanguageModelFacilitator"
,
"no model for ${locale.language}"
)
Log
.
d
(
"LanguageModelFacilitator"
,
"no model for ${locale.language}"
)
skipLanguage
=
locale
.
language
return
null
return
null
}
}
}
}
...
@@ -448,6 +451,7 @@ public class LanguageModelFacilitator(
...
@@ -448,6 +451,7 @@ public class LanguageModelFacilitator(
withContext
(
Dispatchers
.
Default
)
{
withContext
(
Dispatchers
.
Default
)
{
ModelPaths
.
modelOptionsUpdated
.
collect
{
ModelPaths
.
modelOptionsUpdated
.
collect
{
Log
.
d
(
"LanguageModelFacilitator"
,
"ModelPaths options updated, destroying model"
)
Log
.
d
(
"LanguageModelFacilitator"
,
"ModelPaths options updated, destroying model"
)
skipLanguage
=
null
destroyModel
()
destroyModel
()
}
}
}
}
...
...
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