Skip to content

Commit e23ee8b

Browse files
committed
widen transformer context limits 70 to 200 chars
1 parent cc853fc commit e23ee8b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

java/src/org/futo/inputmethod/latin/xlm/LanguageModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class LanguageModel(
134134
if(matchStart != -1) context = context.substring(matchStart)
135135

136136
// Trim the context
137-
val stillNeedTrimming = { context: String -> context.length > 70 || context.count { it == ' ' } > 16 }
137+
val stillNeedTrimming = { context: String -> context.length > 200 || context.count { it == ' ' } > 40 }
138138
if (stillNeedTrimming(context)) {
139139
val v = context.indexOfLast { it == '.' || it == '?' || it == '!' }
140140
if (v != -1) {
@@ -147,10 +147,10 @@ class LanguageModel(
147147
}
148148

149149
if (stillNeedTrimming(context) && context.contains(" ")) {
150-
context = context.split(' ').takeLast(5).joinToString(separator = " ")
150+
context = context.split(' ').takeLast(15).joinToString(separator = " ")
151151
}
152152

153-
if (context.length > 144) {
153+
if (context.length > 400) {
154154
// This context probably contains some spam without adequate whitespace to trim, set it to blank
155155
context = ""
156156
}

0 commit comments

Comments
 (0)