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
2f51b209
Commit
2f51b209
authored
6 years ago
by
Jonas Wolff
Browse files
Options
Downloads
Patches
Plain Diff
Fixed wrong actions, corrected few typos.
parent
36ddd9b0
No related branches found
No related tags found
1 merge request
!20
Example
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/actions.py
+7
-26
7 additions, 26 deletions
example/actions.py
with
7 additions
and
26 deletions
example/actions.py
+
7
−
26
View file @
2f51b209
...
@@ -58,8 +58,6 @@ class ActionSearchDayOfDeath(Action):
...
@@ -58,8 +58,6 @@ class ActionSearchDayOfDeath(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_day_of_death
=
row
[
'
day_of_death
'
]
actual_day_of_death
=
row
[
'
day_of_death
'
]
if
actual_day_of_death
is
None
:
return
[
SlotSet
(
'
day_of_death
'
,
[])]
return
[
SlotSet
(
'
day_of_death
'
,
actual_day_of_death
if
actual_day_of_death
is
not
None
else
[])]
return
[
SlotSet
(
'
day_of_death
'
,
actual_day_of_death
if
actual_day_of_death
is
not
None
else
[])]
...
@@ -94,8 +92,6 @@ class ActionSearchPlaceOfDeath(Action):
...
@@ -94,8 +92,6 @@ class ActionSearchPlaceOfDeath(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_place_of_death
=
row
[
'
place_of_death
'
]
actual_place_of_death
=
row
[
'
place_of_death
'
]
if
actual_place_of_death
is
None
:
return
[
SlotSet
(
'
place_of_death
'
,
[])]
return
[
SlotSet
(
'
place_of_death
'
,
actual_place_of_death
if
actual_place_of_death
is
not
None
else
[])]
return
[
SlotSet
(
'
place_of_death
'
,
actual_place_of_death
if
actual_place_of_death
is
not
None
else
[])]
...
@@ -123,9 +119,6 @@ class ActionSearchIsAlive(Action):
...
@@ -123,9 +119,6 @@ class ActionSearchIsAlive(Action):
import
csv
import
csv
import
re
import
re
person
=
tracker
.
get_slot
(
'
physicist
'
)
person
=
tracker
.
get_slot
(
'
physicist
'
)
if
person
==
None
:
dispatcher
.
utter_message
(
"
Person nicht gefunden
"
)
return
[]
name_regex
=
re
.
compile
(
person
,
re
.
IGNORECASE
)
name_regex
=
re
.
compile
(
person
,
re
.
IGNORECASE
)
actual_is_alive
=
None
actual_is_alive
=
None
with
open
(
'
data.tsv
'
)
as
csvfile
:
with
open
(
'
data.tsv
'
)
as
csvfile
:
...
@@ -133,8 +126,6 @@ class ActionSearchIsAlive(Action):
...
@@ -133,8 +126,6 @@ class ActionSearchIsAlive(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_is_alive
=
row
[
'
is_alive
'
]
actual_is_alive
=
row
[
'
is_alive
'
]
if
actual_is_alive
is
None
:
return
[
SlotSet
(
'
is_alive
'
,
[])]
return
[
SlotSet
(
'
is_alive
'
,
actual_is_alive
if
actual_is_alive
is
not
None
else
[])]
return
[
SlotSet
(
'
is_alive
'
,
actual_is_alive
if
actual_is_alive
is
not
None
else
[])]
...
@@ -169,8 +160,6 @@ class ActionSearchNumSpouses(Action):
...
@@ -169,8 +160,6 @@ class ActionSearchNumSpouses(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_num_spouses
=
row
[
'
num_spouses
'
]
actual_num_spouses
=
row
[
'
num_spouses
'
]
if
actual_num_spouses
is
None
:
return
[
SlotSet
(
'
num_spouses
'
,
[])]
return
[
SlotSet
(
'
num_spouses
'
,
actual_num_spouses
if
actual_num_spouses
is
not
None
else
[])]
return
[
SlotSet
(
'
num_spouses
'
,
actual_num_spouses
if
actual_num_spouses
is
not
None
else
[])]
...
@@ -205,8 +194,6 @@ class ActionSearchPrimaryEducation(Action):
...
@@ -205,8 +194,6 @@ class ActionSearchPrimaryEducation(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_primary_education
=
row
[
'
primary_education
'
]
actual_primary_education
=
row
[
'
primary_education
'
]
if
actual_primary_education
is
None
:
return
[
SlotSet
(
'
primary_education
'
,
[])]
return
[
SlotSet
(
'
primary_education
'
,
actual_primary_education
if
actual_primary_education
is
not
None
else
[])]
return
[
SlotSet
(
'
primary_education
'
,
actual_primary_education
if
actual_primary_education
is
not
None
else
[])]
...
@@ -241,22 +228,20 @@ class ActionSearchUniversity(Action):
...
@@ -241,22 +228,20 @@ class ActionSearchUniversity(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_university
=
row
[
'
university
'
]
actual_university
=
row
[
'
university
'
]
if
actual_university
is
None
:
return
[
SlotSet
(
'
university
'
,
[])]
return
[
SlotSet
(
'
university
'
,
actual_university
if
actual_university
is
not
None
else
[])]
return
[
SlotSet
(
'
university
'
,
actual_university
if
actual_university
is
not
None
else
[])]
class
ActionUtter
AreaOfResearch
(
Action
):
class
ActionUtter
University
(
Action
):
def
name
(
self
):
def
name
(
self
):
return
'
action_utter_
area_of_research
'
return
'
action_utter_
university
'
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
def
run
(
self
,
dispatcher
,
tracker
,
domain
):
person
=
tracker
.
get_slot
(
'
physicist
'
)
person
=
tracker
.
get_slot
(
'
physicist
'
)
area_of_research
=
tracker
.
get_slot
(
'
area_of_research
'
)
university
=
tracker
.
get_slot
(
'
university
'
)
if
area_of_research
==
None
:
if
university
==
None
:
dispatcher
.
utter_message
(
"
Error:
Area of Research
of
"
+
person
+
"
not known.
"
)
dispatcher
.
utter_message
(
"
Error:
University
of
"
+
person
+
"
not known.
"
)
else
:
else
:
dispatcher
.
utter_message
(
"
The
Area of research
of
"
+
person
+
"
is
"
+
area_of_research
+
"
.
"
)
dispatcher
.
utter_message
(
"
The
University
of
"
+
person
+
"
is
"
+
university
+
"
.
"
)
return
[]
return
[]
#
#
...
@@ -277,8 +262,6 @@ class ActionSearchWorkplace(Action):
...
@@ -277,8 +262,6 @@ class ActionSearchWorkplace(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_workplace
=
row
[
'
workplace
'
]
actual_workplace
=
row
[
'
workplace
'
]
if
actual_workplace
is
None
:
return
[
SlotSet
(
'
workplace
'
,
[])]
return
[
SlotSet
(
'
workplace
'
,
actual_workplace
if
actual_workplace
is
not
None
else
[])]
return
[
SlotSet
(
'
workplace
'
,
actual_workplace
if
actual_workplace
is
not
None
else
[])]
...
@@ -313,8 +296,6 @@ class ActionSearchAwards(Action):
...
@@ -313,8 +296,6 @@ class ActionSearchAwards(Action):
for
row
in
spamreader
:
for
row
in
spamreader
:
if
name_regex
.
match
(
row
[
'
name
'
]):
if
name_regex
.
match
(
row
[
'
name
'
]):
actual_awards
=
row
[
'
awards
'
]
actual_awards
=
row
[
'
awards
'
]
if
actual_awards
is
None
:
return
[
SlotSet
(
'
awards
'
,
[])]
return
[
SlotSet
(
'
awards
'
,
actual_awards
if
actual_awards
is
not
None
else
[])]
return
[
SlotSet
(
'
awards
'
,
actual_awards
if
actual_awards
is
not
None
else
[])]
...
@@ -328,5 +309,5 @@ class ActionUtterAwards(Action):
...
@@ -328,5 +309,5 @@ class ActionUtterAwards(Action):
if
awards
==
None
:
if
awards
==
None
:
dispatcher
.
utter_message
(
"
Error: Awards of
"
+
person
+
"
not known.
"
)
dispatcher
.
utter_message
(
"
Error: Awards of
"
+
person
+
"
not known.
"
)
else
:
else
:
dispatcher
.
utter_message
(
"
The Awards of
"
+
person
+
"
is
"
+
awards
+
"
.
"
)
dispatcher
.
utter_message
(
"
The Awards of
"
+
person
+
"
are
"
+
awards
+
"
.
"
)
return
[]
return
[]
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