1
0
mirror of https://github.com/fumiama/emozi.git synced 2026-06-13 06:50:35 +08:00

feat(cmd): add Lookup

This commit is contained in:
源文雨
2024-02-15 21:12:14 +09:00
parent f2265b4916
commit 3116a2fa7e
8 changed files with 208 additions and 174 deletions

View File

@@ -8,6 +8,19 @@ import (
const = '🈳'
// Lookup 查一个汉字 (可能是多音字)
func (c *Coder) Lookup(ch rune) (explains []string, err error) {
lst, _, err := c.查字(ch, make([]字表, 0, 8))
if err != nil || len(lst) == 0 {
return
}
explains = make([]string, len(lst))
for i, x := range lst {
explains[i] = x.String()
}
return
}
func 随机正查(m [][]string, isRandom bool, i uint8) string {
lst := m[i]
if len(lst) == 0 {