package speechNlu import "speech-nlu-parse/model" type DomainFunc func(params *model.SpeechDomainParams) []byte var handlers = make(map[string]DomainFunc) // 注册函数:将处理函数绑定到特定key func DomainRegister(key string, value DomainFunc) { handlers[key] = value } // 查询函数:通过key获取对应的处理函数 func getHandler(key string) (handler DomainFunc, ok bool) { handler, ok = handlers[key] return } func register() { DomainRegister(WEATHER, weatherDomain) DomainRegister(CHAT, chatDomain) DomainRegister(CALENDAR, calendarDomain) DomainRegister(NEWS, newsDomain) DomainRegister(ANCIENTPOEM, ancientpoemDomain) //体育无 //DomainRegister(SPORTS, sportsDomain) DomainRegister(JOKE, jokeDomain) DomainRegister(ASTRO, astroDomain) //股票无 //DomainRegister(STOCK, stockDomain) DomainRegister(TRANSLATE, translateDomain) DomainRegister(ALARM, alarmDomain) DomainRegister(SCIENCE, scienceDomain) DomainRegister(CHENGYU, chengyuDomain) DomainRegister(BAIKE, baikeDomain) DomainRegister(FM, fmDomain) DomainRegister(CHILDMUSIC, musicDomain) DomainRegister(GLOBALCTRL, globalCtrlDomain) DomainRegister(PlayCTRL, playCtrlDomain) DomainRegister(MUSIC, musicDomain) DomainRegister(HELP, helpDomain) DomainRegister(STORY, fmDomain) DomainRegister(FINANCE, financeDomain) DomainRegister(CONVERT, convertDomain) DomainRegister(HOLIDAY, holidayDomain) // //DomainRegisterV2(CHAT, chatDomainV2) //DomainRegisterV2(MCHAT, chatDomainV2) // mchat //DomainRegisterV2(HOLIDAY, holidayDomainV2) //DomainRegisterV2(NEWS, newsDomainV2) //DomainRegisterV2(ANCIENTPOEM, ancientpoemDomainV2) //DomainRegisterV2(SPORTS, sportsDomainV2) //DomainRegisterV2(JOKE, jokeDomainV2) //DomainRegisterV2(ASTRO, astroDomainV2) //DomainRegisterV2(STOCK, stockDomainV2) //DomainRegisterV2(TRANSLATE, translateDomainV2) //DomainRegisterV2(ALARM, alarmDomainV2) //DomainRegisterV2(SCIENCE, scienceDomainV2) //DomainRegisterV2(CHENGYU, chengyuDomainV2) //DomainRegisterV2(REMINDERV2, alarmDomainV2) //DomainRegisterV2(GLOBALCTRL3, globalCtrlDomainV2) //DomainRegisterV2(MEDIACTRL, mediaCtrlDomainV2) //DomainRegisterV2(BAIKE, baikeDomainV2) //DomainRegisterV2(FM, fmDomainV2) //DomainRegisterV2(DEFAULT, defaultDomainV2) //DomainRegisterV2(MUSIC, musicDomainV2) //DomainRegisterV2(VOLUMECTRL3, volumeCtrl3DomainV2) //DomainRegisterV2(SCREENCONTROL, screenCtrlDomainV2) //DomainRegisterV2(WORLDRECORDSQAPAIRS, worldRecordsQaPairsDomainV2) }