Skip to content
Snippets Groups Projects
Commit c5afc1fc authored by Jonas Wolff's avatar Jonas Wolff
Browse files

fixed entity name and nlu stuff

parent 897377ee
No related branches found
No related tags found
1 merge request!20Example
......@@ -9,19 +9,21 @@ class ActionSearchBirthplace(Action):
return 'action_search_birthplace'
def run(self, dispatcher, tracker, domain):
import csv
import re
person = tracker.get_slot('physicist')
name_regex = re.compile(person, re.IGNORECASE)
actual_birthplace = None
with open('data.tsv') as csvfile:
spamreader = csv.DictReader(csvfile, delimiter='\t')
for row in spamreader:
if name_regex.match(row['name']):
actual_birthplace = row['birthplace']
if actual_birthplace is None:
return[SlotSet('birthplace', [])]
return [SlotSet('birthplace', actual_birthplace if actual_birthplace is not None else [])]
dispatcher.utter_message("Person found:" + person)
#import csv
#import re
#person = tracker.get_slot('physicist')
#name_regex = re.compile(person, re.IGNORECASE)
#actual_birthplace = None
#with open('data.tsv') as csvfile:
# spamreader = csv.DictReader(csvfile, delimiter='\t')
# for row in spamreader:
# if name_regex.match(row['name']):
# actual_birthplace = row['birthplace']
#if actual_birthplace is None:
return[SlotSet('birthplace', [])]
#return [SlotSet('birthplace', actual_birthplace if actual_birthplace is not None else [])]
class ActionUtterBirthplace(Action):
......@@ -29,12 +31,14 @@ class ActionUtterBirthplace(Action):
return 'action_utter_birthplace'
def run(self, dispatcher, tracker, domain):
person = tracker.get_slot('physicist')
birthplace = tracker.get_slot('birthplace')
if birthplace == None:
dispatcher.utter_message("Error: Birthplace of " + person + " not known.")
else:
dispatcher.utter_message("The birthplace of " + person + " is " + birthplace + ".")
#person = tracker.get_slot('physicist')
#birthplace = tracker.get_slot('birthplace')
#if birthplace == None:
# dispatcher.utter_message("Error: Birthplace of " + person + " not
# known.")
#else:
# dispatcher.utter_message("The birthplace of " + person + " is " +
# birthplace + ".")
return []
#
......@@ -120,6 +124,9 @@ class ActionSearchIsAlive(Action):
import csv
import re
person = tracker.get_slot('physicist')
if person == None:
dispatcher.utter_message("Person nicht gefunden")
return []
name_regex = re.compile(person, re.IGNORECASE)
actual_is_alive = None
with open('data.tsv') as csvfile:
......
......@@ -7,54 +7,54 @@
- goodbye
## intent:birthplace
- where was [Albert Einstein](Physicist) born
- where is [Albert Einstein](Physicist) from
- what is [Albert Einstein](Physicist) birthplace
- birthplace of [Albert Einstein](Physicist)
- where was [Albert Einstein](physicist) born
- where is [Albert Einstein](physicist) from
- what is [Albert Einstein](physicist) birthplace
- birthplace of [Albert Einstein](physicist)
## intent:birthdate
- when was [Albert Einstein](Physicist) born
- what is [Albert Einstein](Physicist) birthdate
- when was [Albert Einstein](physicist) born
- what is [Albert Einstein](physicist) birthdate
## intent:day_of_death
- when did [Albert Einstein](Physicist) die
- what is [Albert Einstein](Physicist) date of death
- when did [Albert Einstein](physicist) die
- what is [Albert Einstein](physicist) date of death
## intent:place_of_death
- where did [Albert Einstein](Physicist) die
- where is [Albert Einstein](Physicist) place of death
- where did [Albert Einstein](physicist) die
- where is [Albert Einstein](physicist) place of death
## intent:is_alive
- is [Albert Einstein](Physicist) still alive
- is [Albert Einstein](Physicist) dead
- is [Albert Einstein](physicist) still alive
- is [Albert Einstein](physicist) dead
## intent:num_spouses
- how often was [Albert Einstein](Physicist) married
- was [Albert Einstein](Physicist) married
- how many spouses did have [Albert Einstein](Physicist)
- how often was [Albert Einstein](physicist) married
- was [Albert Einstein](physicist) married
- how many spouses did have [Albert Einstein](physicist)
## intent:primary_education
- where did [Albert Einstein](Physicist) go to school
- which school did [Albert Einstein](Physicist) go to
- where did [Albert Einstein](physicist) go to school
- which school did [Albert Einstein](physicist) go to
## intent:university
- which university did [Albert Einstein](Physicist) go to
- which university did [Albert Einstein](Physicist) attend
- where did [Albert Einstein](Physicist) study
- which university did [Albert Einstein](physicist) go to
- which university did [Albert Einstein](physicist) attend
- where did [Albert Einstein](physicist) study
## intent:area_of_research
- what was [Albert Einstein](Physicist) area of research
- what was [Albert Einstein](Physicist) field of interest
- what did [Albert Einstein](Physicist) research
- what was [Albert Einstein](physicist) area of research
- what was [Albert Einstein](physicist) field of interest
- what did [Albert Einstein](physicist) research
## intent:workplace
- where did [Albert Einstein](Physicist) work
- where was [Albert Einstein](Physicist) workplace
- what institute did [Albert Einstein](Physicist) work at
- what university did [Albert Einstein](Physicist) work at
- where did [Albert Einstein](physicist) work
- where was [Albert Einstein](physicist) workplace
- what institute did [Albert Einstein](physicist) work at
- what university did [Albert Einstein](physicist) work at
## intent:awards
- what awards did [Albert Einstein](Physicist) win
- what are [Albert Einstein](Physicist) awards
- did [Albert Einstein](Physicist) win the nobel price
- what awards did [Albert Einstein](physicist) win
- what are [Albert Einstein](physicist) awards
- did [Albert Einstein](physicist) win the nobel price
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment