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

Added Max Planck as an example in the tsv

parent c5afc1fc
No related branches found
No related tags found
1 merge request!20Example
......@@ -9,21 +9,22 @@ class ActionSearchBirthplace(Action):
return 'action_search_birthplace'
def run(self, dispatcher, tracker, domain):
person = tracker.get_slot('physicist')
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 [])]
#if person == None:
# dispatcher.utter_message("No Person found")
#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']
return [SlotSet('birthplace', actual_birthplace if actual_birthplace is not None else [])]
class ActionUtterBirthplace(Action):
......@@ -31,14 +32,12 @@ 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 []
#
......
name birthplace birthdate day_of_death place_of_death is_alive num_spouses primary_education university area_of_research workplace awards
Albert Einstein Ulm 14.03.1879 18.04.1955 Princeton False 2.00 Luitpold Gymnasium University of Bern phylosophy and theoretical physics "Swiss Patent Office (Bern) (1902–1909), University of Bern (1908–1909), University of Zurich (1909–1911), Charles University in Prague (1911–1912), ETH Zurich (1912–1914), Prussian Academy of Sciences (1914–1933), Humboldt University " "Barnard Medal (1920), Nobel Prize in Physics (1921), Matteucci Medal (1921), ForMemRS (1921)[3], Copley Medal (1925)[3], Gold Medal of the Royal Astronomical Society (1926), Max Planck Medal (1929), Time Person of the Centu"
Galileo Galilei Pisa 15.02.1564 08.01.1642 Arcetri False 1.00 Vallombrosa Abbey University of Pisa "astronomy, physics, engineering, natural philosophy and mathematics" University of Pisa (1589-1592) and University of Padua (1592-1610) honorary degree by the Jesuit College in Rome
Max Planck Kiel 23.04.1858 04.10.1947 Göttingen False 2.00 Maximilians gymnasium "University of Munich, Friedrich Wilhelms University" "theoretical physics, physical chemistry" "University of Kiel, University of Göttingen, Kaiser Wilhelm Society" "Nobel Prize in Physics (1918), Lorentz Medal (1927), Copley Medal (1929), Max Planck Medal (1929), Goethe Prize (1945)"
......@@ -8,53 +8,53 @@
## intent:birthplace
- where was [Albert Einstein](physicist) born
- where is [Albert Einstein](physicist) from
- where is [Galileo Galilei](physicist) from
- what is [Albert Einstein](physicist) birthplace
- birthplace of [Albert Einstein](physicist)
- birthplace of [Galileo Galilei](physicist)
## intent:birthdate
- when was [Albert Einstein](physicist) born
- what is [Albert Einstein](physicist) birthdate
- what is [Galileo Galilei](physicist) birthdate
## intent:day_of_death
- when did [Albert Einstein](physicist) die
- what is [Albert Einstein](physicist) date of death
- what is [Galileo Galilei](physicist) date of death
## intent:place_of_death
- where did [Albert Einstein](physicist) die
- where is [Albert Einstein](physicist) place of death
- where is [Galileo Galilei](physicist) place of death
## intent:is_alive
- is [Albert Einstein](physicist) still alive
- is [Albert Einstein](physicist) dead
- is [Galileo Galilei](physicist) dead
## intent:num_spouses
- how often was [Albert Einstein](physicist) married
- was [Albert Einstein](physicist) married
- was [Galileo Galilei](physicist) married
- how many spouses did have [Albert Einstein](physicist)
## intent:primary_education
- where did [Albert Einstein](physicist) go to school
- where did [Galileo Galilei](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 [Galileo Galilei](physicist) go to
- which university did [Albert Einstein](physicist) attend
- where did [Albert Einstein](physicist) study
- where did [Galileo Galilei](physicist) study
## intent:area_of_research
- what was [Albert Einstein](physicist) area of research
- what was [Albert Einstein](physicist) field of interest
- what was [Galileo Galilei](physicist) field of interest
- what did [Albert Einstein](physicist) research
## intent:workplace
- where did [Albert Einstein](physicist) work
- where did [Galileo Galilei](physicist) work
- where was [Albert Einstein](physicist) workplace
- what institute did [Albert Einstein](physicist) work at
- what institute did [Galileo Galilei](physicist) work at
- what university did [Albert Einstein](physicist) work at
## intent:awards
- what awards did [Albert Einstein](physicist) win
- what awards did [Galileo Galilei](physicist) win
- what are [Albert Einstein](physicist) awards
- did [Albert Einstein](physicist) win the nobel price
- did [Galileo Galilei](physicist) win the nobel price
......@@ -17,7 +17,7 @@
- action_utter_day_of_death
## place_of_death
* is_alive{"physicist": "albert einstein"}
* place_of_death{"physicist": "albert einstein"}
- action_search_place_of_death
- action_utter_place_of_death
......
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