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
c5afc1fc
Commit
c5afc1fc
authored
6 years ago
by
Jonas Wolff
Browse files
Options
Downloads
Patches
Plain Diff
fixed entity name and nlu stuff
parent
897377ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!20
Example
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
example/actions.py
+25
-18
25 additions, 18 deletions
example/actions.py
example/nlu.md
+30
-30
30 additions, 30 deletions
example/nlu.md
with
55 additions
and
48 deletions
example/actions.py
+
25
−
18
View file @
c5afc1fc
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
example/nlu.md
+
30
−
30
View file @
c5afc1fc
...
...
@@ -7,54 +7,54 @@
-
goodbye
## intent:birthplace
-
where was
[
Albert Einstein
](
P
hysicist
)
born
-
where is
[
Albert Einstein
](
P
hysicist
)
from
-
what is
[
Albert Einstein
](
P
hysicist
)
birthplace
-
birthplace of
[
Albert Einstein
](
P
hysicist
)
-
where was
[
Albert Einstein
](
p
hysicist
)
born
-
where is
[
Albert Einstein
](
p
hysicist
)
from
-
what is
[
Albert Einstein
](
p
hysicist
)
birthplace
-
birthplace of
[
Albert Einstein
](
p
hysicist
)
## intent:birthdate
-
when was
[
Albert Einstein
](
P
hysicist
)
born
-
what is
[
Albert Einstein
](
P
hysicist
)
birthdate
-
when was
[
Albert Einstein
](
p
hysicist
)
born
-
what is
[
Albert Einstein
](
p
hysicist
)
birthdate
## intent:day_of_death
-
when did
[
Albert Einstein
](
P
hysicist
)
die
-
what is
[
Albert Einstein
](
P
hysicist
)
date of death
-
when did
[
Albert Einstein
](
p
hysicist
)
die
-
what is
[
Albert Einstein
](
p
hysicist
)
date of death
## intent:place_of_death
-
where did
[
Albert Einstein
](
P
hysicist
)
die
-
where is
[
Albert Einstein
](
P
hysicist
)
place of death
-
where did
[
Albert Einstein
](
p
hysicist
)
die
-
where is
[
Albert Einstein
](
p
hysicist
)
place of death
## intent:is_alive
-
is
[
Albert Einstein
](
P
hysicist
)
still alive
-
is
[
Albert Einstein
](
P
hysicist
)
dead
-
is
[
Albert Einstein
](
p
hysicist
)
still alive
-
is
[
Albert Einstein
](
p
hysicist
)
dead
## intent:num_spouses
-
how often was
[
Albert Einstein
](
P
hysicist
)
married
-
was
[
Albert Einstein
](
P
hysicist
)
married
-
how many spouses did have
[
Albert Einstein
](
P
hysicist
)
-
how often was
[
Albert Einstein
](
p
hysicist
)
married
-
was
[
Albert Einstein
](
p
hysicist
)
married
-
how many spouses did have
[
Albert Einstein
](
p
hysicist
)
## intent:primary_education
-
where did
[
Albert Einstein
](
P
hysicist
)
go to school
-
which school did
[
Albert Einstein
](
P
hysicist
)
go to
-
where did
[
Albert Einstein
](
p
hysicist
)
go to school
-
which school did
[
Albert Einstein
](
p
hysicist
)
go to
## intent:university
-
which university did
[
Albert Einstein
](
P
hysicist
)
go to
-
which university did
[
Albert Einstein
](
P
hysicist
)
attend
-
where did
[
Albert Einstein
](
P
hysicist
)
study
-
which university did
[
Albert Einstein
](
p
hysicist
)
go to
-
which university did
[
Albert Einstein
](
p
hysicist
)
attend
-
where did
[
Albert Einstein
](
p
hysicist
)
study
## intent:area_of_research
-
what was
[
Albert Einstein
](
P
hysicist
)
area of research
-
what was
[
Albert Einstein
](
P
hysicist
)
field of interest
-
what did
[
Albert Einstein
](
P
hysicist
)
research
-
what was
[
Albert Einstein
](
p
hysicist
)
area of research
-
what was
[
Albert Einstein
](
p
hysicist
)
field of interest
-
what did
[
Albert Einstein
](
p
hysicist
)
research
## intent:workplace
-
where did
[
Albert Einstein
](
P
hysicist
)
work
-
where was
[
Albert Einstein
](
P
hysicist
)
workplace
-
what institute did
[
Albert Einstein
](
P
hysicist
)
work at
-
what university did
[
Albert Einstein
](
P
hysicist
)
work at
-
where did
[
Albert Einstein
](
p
hysicist
)
work
-
where was
[
Albert Einstein
](
p
hysicist
)
workplace
-
what institute did
[
Albert Einstein
](
p
hysicist
)
work at
-
what university did
[
Albert Einstein
](
p
hysicist
)
work at
## intent:awards
-
what awards did
[
Albert Einstein
](
P
hysicist
)
win
-
what are
[
Albert Einstein
](
P
hysicist
)
awards
-
did
[
Albert Einstein
](
P
hysicist
)
win the nobel price
-
what awards did
[
Albert Einstein
](
p
hysicist
)
win
-
what are
[
Albert Einstein
](
p
hysicist
)
awards
-
did
[
Albert Einstein
](
p
hysicist
)
win the nobel price
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