mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
more cangjie improvements
This commit is contained in:
@@ -2,13 +2,14 @@ hi,的
|
||||
hi,我
|
||||
hi,得
|
||||
ao,是
|
||||
klg,在
|
||||
kg,在
|
||||
od,他
|
||||
mn,到
|
||||
vo,以
|
||||
yu,就
|
||||
mr,可
|
||||
of,你
|
||||
op,您
|
||||
ml,而
|
||||
sl,那
|
||||
hl,所
|
||||
|
||||
@@ -2,13 +2,14 @@ hi,的
|
||||
hi,我
|
||||
hi,得
|
||||
ao,是
|
||||
klg,在
|
||||
kg,在
|
||||
od,他
|
||||
mn,到
|
||||
vo,以
|
||||
yu,就
|
||||
mr,可
|
||||
of,你
|
||||
op,您
|
||||
ml,而
|
||||
sl,那
|
||||
hl,所
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user