Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Wiki Rasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tm-chatbot
Wiki Rasa
Commits
460959c6
Commit
460959c6
authored
6 years ago
by
Lukas Gehrke
Browse files
Options
Downloads
Patches
Plain Diff
Fuegt fehlende Actions zu area_of_research und birthdate hinzu.
parent
529c9507
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Example
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
example/actions.py
+67
-5
67 additions, 5 deletions
example/actions.py
example/domain.yml
+5
-1
5 additions, 1 deletion
example/domain.yml
example/stories.md
+5
-0
5 additions, 0 deletions
example/stories.md
with
77 additions
and
6 deletions
example/actions.py
+
67
−
5
View file @
460959c6
...
...
@@ -9,11 +9,6 @@ class ActionSearchBirthplace(Action):
return
'
action_search_birthplace
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
#person = tracker.get_slot('physicist')
#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
'
)
...
...
@@ -39,6 +34,40 @@ class ActionUtterBirthplace(Action):
dispatcher
.
utter_message
(
"
Birthplace of {} is {}.
"
.
format
(
person
,
birthplace
))
return
[]
#
# Birthdate
#
class
ActionUtterBirthdate
(
Action
):
def
name
(
self
):
return
'
action_utter_birthdate
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
person
=
tracker
.
get_slot
(
'
physicist
'
)
birthdate
=
tracker
.
get_slot
(
'
birthdate
'
)
dispatcher
.
utter_message
(
"
Birthdate of {} is {}.
"
.
format
(
person
,
birthdate
))
return
[]
class
ActionSearchBirthdate
(
Action
):
def
name
(
self
):
return
'
action_search_birthdate
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
import
csv
import
re
person
=
tracker
.
get_slot
(
'
physicist
'
)
name_regex
=
re
.
compile
(
person
,
re
.
IGNORECASE
)
actual_birthdate
=
None
with
open
(
'
data.tsv
'
)
as
csvfile
:
spamreader
=
csv
.
DictReader
(
csvfile
,
delimiter
=
'
\t
'
)
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_birthdate
=
row
[
'
birthdate
'
]
return
[
SlotSet
(
'
birthdate
'
,
actual_birthdate
if
actual_birthdate
is
not
None
and
actual_birthdate
is
not
""
else
"
not known
"
)]
#
# Day of death
#
...
...
@@ -237,6 +266,39 @@ class ActionUtterUniversity(Action):
dispatcher
.
utter_message
(
"
The University of {} is {}.
"
.
format
(
person
,
university
))
return
[]
#
# Area of Research
#
class
ActionSearchAreaOfResearch
(
Action
):
def
name
(
self
):
return
'
action_search_area_of_research
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
import
csv
import
re
person
=
tracker
.
get_slot
(
'
physicist
'
)
name_regex
=
re
.
compile
(
person
,
re
.
IGNORECASE
)
actual_area_of_research
=
None
with
open
(
'
data.tsv
'
)
as
csvfile
:
spamreader
=
csv
.
DictReader
(
csvfile
,
delimiter
=
'
\t
'
)
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_area_of_research
=
row
[
'
area_of_research
'
]
return
[
SlotSet
(
'
area_of_research
'
,
actual_area_of_research
if
actual_area_of_research
is
not
None
and
actual_area_of_research
is
not
""
else
"
not known
"
)]
class
ActionUtterAreaOfResearch
(
Action
):
def
name
(
self
):
return
'
action_utter_area_of_research
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
person
=
tracker
.
get_slot
(
'
physicist
'
)
area_of_research
=
tracker
.
get_slot
(
'
area_of_research
'
)
dispatcher
.
utter_message
(
"
{} did research in {}.
"
.
format
(
person
,
area_of_research
))
return
[]
#
# Workplace
#
...
...
This diff is collapsed.
Click to expand it.
example/domain.yml
+
5
−
1
View file @
460959c6
...
...
@@ -18,6 +18,8 @@ actions:
-
utter_goodbye
-
action_search_birthplace
-
action_utter_birthplace
-
action_search_birthdate
-
action_utter_birthdate
-
action_search_day_of_death
-
action_utter_day_of_death
-
action_search_place_of_death
...
...
@@ -45,6 +47,8 @@ slots:
type
:
text
birthplace
:
type
:
unfeaturized
birthdate
:
type
:
unfeaturized
day_of_death
:
type
:
unfeaturized
place_of_death
:
...
...
@@ -66,7 +70,7 @@ slots:
templates
:
utter_greet
:
-
text
:
"
Hi,
enter
Physicist
to
gather
birthplace
information."
-
text
:
"
Hi,
enter
Physicist
to
gather
information."
utter_goodbye
:
-
text
:
"
Bye"
This diff is collapsed.
Click to expand it.
example/stories.md
+
5
−
0
View file @
460959c6
...
...
@@ -11,6 +11,11 @@
-
action_search_birthplace
-
action_utter_birthplace
## birthdate
*
birthdate{"physicist": "albert einstein}
-
action_search_birthdate
-
action_utter_birthdate
## day_of_death
*
day_of_death{"physicist": "albert einstein"}
-
action_search_day_of_death
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment