diff --git a/analysis/sentence.go b/analysis/sentence.go index ae732b1..6a0e84b 100644 --- a/analysis/sentence.go +++ b/analysis/sentence.go @@ -82,7 +82,8 @@ func (sentence Sentence) PredictTag(n gonn.NeuralNetwork) string { return resultsTag[i].Value > resultsTag[j].Value }) - // Don't understand if the rate is under 0.35 + // TODO: Review the value here, arbitrary choice of 0.50. + // If the model is not sure at 50% that it is the right tag returns the "don't understand" tag if resultsTag[0].Value < 0.50 { return "don't understand" } diff --git a/language/countries.go b/language/countries.go index 3d96209..586902b 100644 --- a/language/countries.go +++ b/language/countries.go @@ -34,7 +34,7 @@ func SerializeCountries() (countries []Country) { return countries } -// Returns the country found in the sentence +// FindCountry returns the country found in the sentence and if no country is found, returns an empty Country struct func FindCountry(sentence string) Country { for _, country := range countries { if !strings.Contains(strings.ToLower(sentence), strings.ToLower(country.CommonName)) && diff --git a/res/intents.json b/res/intents.json index 9324f75..875bdf4 100644 --- a/res/intents.json +++ b/res/intents.json @@ -11,12 +11,6 @@ "responses": ["I am Olivia your personal assistant", "I am your new personal assistant"], "context": "" }, - { - "tag": "action", - "patterns": ["What are you doing", "What do you do"], - "responses": ["I am speaking to a wonderful person"], - "context": "" - }, { "tag": "job", "patterns": ["What is your job"], @@ -53,6 +47,12 @@ "responses": ["I hope you will feel better !"], "context": "feeling" }, + { + "tag": "actions", + "patterns": ["What can you do ?", "What can I ask you ?"], + "responses": ["You can ask me:\n - The capital of a country\n - The area of a country\n - The currency of a country\n - A random number"], + "context": "" + }, { "tag": "women", "patterns": ["Are you a girl ?", "You are a women ?"], diff --git a/res/messages.json b/res/messages.json index 82c1af0..e709369 100644 --- a/res/messages.json +++ b/res/messages.json @@ -3,13 +3,16 @@ "tag": "don't understand", "messages": [ "I don't understand", - "Sorry but I don't understand" + "Sorry but I don't understand", + "I'm trying to do my best but I don't understand :(", + "Sorry I'm still young, I don't understand" ] }, { "tag": "no country", "messages": [ - "I don't find a country" + "I don't find a country in your message", + "You must specify the country" ] } -] \ No newline at end of file +] diff --git a/util/messages.go b/util/messages.go index 1832ded..8399c26 100644 --- a/util/messages.go +++ b/util/messages.go @@ -25,6 +25,7 @@ func SerializeMessages() (messages []Message) { return messages } +// GetMessage returns a random message which have a specified tag func GetMessage(tag string) string { for _, message := range messages { if message.Tag != tag { diff --git a/util/slice.go b/util/slice.go index d69385c..16c122c 100644 --- a/util/slice.go +++ b/util/slice.go @@ -11,7 +11,7 @@ func Contains(slice []string, text string) bool { return false } -// Return the searched item's index +// Index returns the index of an item in a slice of strings func Index(slice []string, text string) int { for i, item := range slice { if item == text {