more cangjie improvements

This commit is contained in:
minjaesong
2021-10-28 10:32:31 +09:00
parent b15d03f882
commit 18e59ed46b
3 changed files with 14 additions and 10 deletions

View File

@@ -2,13 +2,14 @@ hi,的
hi,我
hi,得
ao,是
klg,在
kg,在
od,他
mn,到
vo,以
yu,就
mr,可
of,你
op,您
ml,而
sl,那
hl,所

View File

@@ -2,13 +2,14 @@ hi,的
hi,我
hi,得
ao,是
klg,在
kg,在
od,他
mn,到
vo,以
yu,就
mr,可
of,你
op,您
ml,而
sl,那
hl,所

View File

@@ -27,13 +27,15 @@ class IMEDictionary(private val filename: String) {
private fun loadDict() {
val reader = FileReader(File("assets/keylayout/", filename))
reader.forEachLine {
val (key, value) = it.split(',')
if (candidates.containsKey(key)) {
candidates[key] += ",$value"
}
else {
candidates[key] = value
keys.add(key)
if (it.contains(',')) {
val (key, value) = it.split(',')
if (candidates.containsKey(key)) {
candidates[key] += ",$value"
}
else {
candidates[key] = value
keys.add(key)
}
}
}
@@ -55,7 +57,7 @@ class IMEDictionary(private val filename: String) {
var index = keys.searchForInterval(key) { it }.second
val allRelevantKeys = ArrayList<String>() // oh, oha, ohag, ohbt, ohby, ...
for (i in 0 until 10) {
for (i in 0 until 400) { // lookahead for length-first sorting, longest lookahead possible is around 300, so I'll give it 400
if (index + 1 >= keys.size) break
val keysym = keys[index + i]
if (!keysym.startsWith(key)) break