Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Removing some intents
Browse files Browse the repository at this point in the history
  • Loading branch information
hugolgst committed May 8, 2019
2 parents fdc946a + 0625ce7 commit 8b99279
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
3 changes: 2 additions & 1 deletion analysis/sentence.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion language/countries.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)) &&
Expand Down
12 changes: 6 additions & 6 deletions res/intents.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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 ?"],
Expand Down
9 changes: 6 additions & 3 deletions res/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
]
1 change: 1 addition & 0 deletions util/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion util/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8b99279

Please sign in to comment.