From 2bc58f10a528491a91bc8c6f6795429d299b73dc Mon Sep 17 00:00:00 2001 From: "zhangzhi.pop" Date: Thu, 4 Nov 2021 17:35:21 +0800 Subject: [PATCH 1/3] style: fix some usage --- network/network.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/network/network.go b/network/network.go index a385fff3..f32c6629 100644 --- a/network/network.go +++ b/network/network.go @@ -46,10 +46,10 @@ func LoadNetwork(fileName string) *Network { // CreateNetwork creates the network by generating the layers, weights and biases func CreateNetwork(locale string, rate float64, input, output Matrix, hiddensNodes ...int) Network { - input = append([][]float64{ + input = append(Matrix{ make([]float64, len(input[0])), }, input...) - output = append([][]float64{ + output = append(Matrix{ make([]float64, len(output[0])), }, output...) From 80354ca572abf090dc1af5a55acb12edc27aeb75 Mon Sep 17 00:00:00 2001 From: "zhangzhi.pop" Date: Tue, 9 Nov 2021 18:32:49 +0800 Subject: [PATCH 2/3] fix: fix some useless usage --- analysis/intents.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/analysis/intents.go b/analysis/intents.go index 86eb86d5..884d2c8a 100644 --- a/analysis/intents.go +++ b/analysis/intents.go @@ -52,13 +52,13 @@ func SerializeModulesIntents(locale string) []Intent { registeredModules := modules.GetModules(locale) intents := make([]Intent, len(registeredModules)) - for _, module := range registeredModules { - intents = append(intents, Intent{ + for k, module := range registeredModules { + intents[k] = Intent{ Tag: module.Tag, Patterns: module.Patterns, Responses: module.Responses, Context: "", - }) + } } return intents From 8e8498cc7e426fbab286c82be429acd9dbd01571 Mon Sep 17 00:00:00 2001 From: "zhangzhi.pop" Date: Wed, 10 Nov 2021 16:03:14 +0800 Subject: [PATCH 3/3] fix:fix some bug --- analysis/format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/analysis/format.go b/analysis/format.go index a7b9f7e5..0b1072aa 100644 --- a/analysis/format.go +++ b/analysis/format.go @@ -69,7 +69,7 @@ func (sentence Sentence) tokenize() (tokens []string) { // stem returns the sentence split in stemmed words func (sentence Sentence) stem() (tokenizeWords []string) { - locale := locales.GetTagByName(sentence.Locale) + locale := locales.GetNameByTag(sentence.Locale) // Set default locale to english if locale == "" { locale = "english"