mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Improve Chinese length in fuzzy search
This commit is contained in:
parent
83f43615c6
commit
2c365edb16
@ -340,7 +340,7 @@ internal fun Char.chineseLength(): Int {
|
||||
return when (this) {
|
||||
in '\u0000'..'\u007F' -> 1
|
||||
in '\u0080'..'\u07FF' -> 2
|
||||
in '\u0800'..'\uFFFF' -> 3
|
||||
else -> 4
|
||||
in '\u0800'..'\uFFFF' -> 2
|
||||
else -> 2
|
||||
}
|
||||
}
|
@ -101,7 +101,7 @@ internal inline fun <T : Any> Collection<T>.fuzzySearchOnly(
|
||||
*/
|
||||
internal fun Group.fuzzySearchMember(
|
||||
nameCardTarget: String,
|
||||
minRate: Double = 0.5, // 参与判断, 用于提示可能的解
|
||||
minRate: Double = 0.2, // 参与判断, 用于提示可能的解
|
||||
matchRate: Double = 0.6,// 最终选择的最少需要的匹配率, 减少歧义
|
||||
/**
|
||||
* 如果有多个值超过 [matchRate], 并相互差距小于等于 [disambiguationRate], 则认为有较大歧义风险, 返回可能的解的列表.
|
||||
|
Loading…
Reference in New Issue
Block a user