Added cj & jyutping lookup

This commit is contained in:
2026-02-20 12:41:04 +08:00
parent 59d5934097
commit f6c9e40540
21 changed files with 114450 additions and 139 deletions

View File

@@ -0,0 +1,42 @@
package cjlookup
import (
"strings"
query "github.com/tgckpg/golifehk/query"
)
func getSearchables() (*[]query.ISearchable, error) {
searchables := []query.ISearchable{}
cjRepl, err := ReadCangJieKeys()
if err != nil {
return nil, err
}
chars := map[string]*CChar{}
ReadCangJieTable(chars, cjRepl)
jpMap, err := ReadJyutPingTable(chars)
if err != nil {
return nil, err
}
for jyutping, chars := range jpMap {
for _, c := range *chars {
cjp := CJyutPing{}
cjp.Ref = c
cjp.SKey = strings.ToUpper(jyutping)
cjp.Key = &cjp.SKey
searchables = append(searchables, &cjp)
}
}
for _, c := range chars {
ccj := CFace{}
ccj.Ref = c
ccj.Key = &c.Face
searchables = append(searchables, &ccj)
}
return &searchables, nil
}