mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
more cangjie improvements
This commit is contained in:
@@ -2,13 +2,14 @@ hi,的
|
|||||||
hi,我
|
hi,我
|
||||||
hi,得
|
hi,得
|
||||||
ao,是
|
ao,是
|
||||||
klg,在
|
kg,在
|
||||||
od,他
|
od,他
|
||||||
mn,到
|
mn,到
|
||||||
vo,以
|
vo,以
|
||||||
yu,就
|
yu,就
|
||||||
mr,可
|
mr,可
|
||||||
of,你
|
of,你
|
||||||
|
op,您
|
||||||
ml,而
|
ml,而
|
||||||
sl,那
|
sl,那
|
||||||
hl,所
|
hl,所
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ hi,的
|
|||||||
hi,我
|
hi,我
|
||||||
hi,得
|
hi,得
|
||||||
ao,是
|
ao,是
|
||||||
klg,在
|
kg,在
|
||||||
od,他
|
od,他
|
||||||
mn,到
|
mn,到
|
||||||
vo,以
|
vo,以
|
||||||
yu,就
|
yu,就
|
||||||
mr,可
|
mr,可
|
||||||
of,你
|
of,你
|
||||||
|
op,您
|
||||||
ml,而
|
ml,而
|
||||||
sl,那
|
sl,那
|
||||||
hl,所
|
hl,所
|
||||||
|
|||||||
@@ -27,13 +27,15 @@ class IMEDictionary(private val filename: String) {
|
|||||||
private fun loadDict() {
|
private fun loadDict() {
|
||||||
val reader = FileReader(File("assets/keylayout/", filename))
|
val reader = FileReader(File("assets/keylayout/", filename))
|
||||||
reader.forEachLine {
|
reader.forEachLine {
|
||||||
val (key, value) = it.split(',')
|
if (it.contains(',')) {
|
||||||
if (candidates.containsKey(key)) {
|
val (key, value) = it.split(',')
|
||||||
candidates[key] += ",$value"
|
if (candidates.containsKey(key)) {
|
||||||
}
|
candidates[key] += ",$value"
|
||||||
else {
|
}
|
||||||
candidates[key] = value
|
else {
|
||||||
keys.add(key)
|
candidates[key] = value
|
||||||
|
keys.add(key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ class IMEDictionary(private val filename: String) {
|
|||||||
var index = keys.searchForInterval(key) { it }.second
|
var index = keys.searchForInterval(key) { it }.second
|
||||||
|
|
||||||
val allRelevantKeys = ArrayList<String>() // oh, oha, ohag, ohbt, ohby, ...
|
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
|
if (index + 1 >= keys.size) break
|
||||||
val keysym = keys[index + i]
|
val keysym = keys[index + i]
|
||||||
if (!keysym.startsWith(key)) break
|
if (!keysym.startsWith(key)) break
|
||||||
|
|||||||
Reference in New Issue
Block a user