Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
61c8c70
commit 308329a
Showing
208 changed files
with
16,142 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,7 +173,7 @@ | |
{ | ||
"start": 52, | ||
"end": 57, | ||
"value": "tomorrow 10 PM", | ||
"value": "10 PM", | ||
"entity": "time" | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,59 @@ | ||
##dict of response for each type of intent | ||
# dict of response for each type of intent | ||
|
||
import datetime | ||
|
||
response = { | ||
"greet":["hey","hello","hi"], | ||
"goodbye":["bye","It was nice talking to you","see you","ttyl"], | ||
"affirm":["cool","I know you would like it"], | ||
"day_preference":["which day of conference ?"], | ||
"time_preference":["Do you have any time preference"], | ||
"events_link":['You can check all the events here <a href="https://conference.pydelhi.org/#schedule_table">PyDelhi events</a>'], | ||
"no_events":["No events found"], | ||
"intro":["I am event bot for pydelhi, I can find you event details in minutes"] | ||
"greet": ["hey", "hello", "hi"], | ||
"goodbye": ["bye", "It was nice talking to you", "see you", "ttyl"], | ||
"affirm": ["cool", "I know you would like it"], | ||
"day_preference": ["which day of conference ?"], | ||
"time_preference": ["Do you have any time preference"], | ||
"events_link": [ | ||
'You can check all the events here <a href="https://conference.pydelhi.org/#schedule_table">PyDelhi events</a>'], | ||
"no_events": ["No events found"], | ||
"intro": ["I am event bot for pydelhi, I can find you event details in minutes"], | ||
"default": ["Sorry I am not trained to answer that yet.", "Oops I didn't understand that sorry"] | ||
} | ||
import datetime | ||
|
||
mapping = { | ||
"now":datetime.datetime.now(), | ||
"now": datetime.datetime.now(), | ||
"tomorrow": datetime.date.today() + datetime.timedelta(days=1), | ||
"today":datetime.date.today(), | ||
"same time":datetime.datetime.now(), | ||
"second day":datetime.datetime.now() | ||
"today": datetime.date.today(), | ||
"same time": datetime.datetime.now(), | ||
"second day": datetime.datetime.now() | ||
} | ||
|
||
|
||
def try_parsing_date(text): | ||
""" | ||
Parses time of string format to a time object | ||
""" | ||
for fmt in ('%I %p', '%I %M %p', '%I:%M %p'): | ||
try: | ||
return datetime.datetime.strptime(text, fmt) | ||
except ValueError:pass | ||
except ValueError: | ||
pass | ||
if ":" in text: | ||
return datetime.datetime.strptime(text+" "+ | ||
("AM" if int(text.split(":")[0])>=8 else "PM"), '%I:%M %p') | ||
return datetime.datetime.strptime(text+" "+ | ||
("AM" if int(text)>=8 else "PM"), '%I %p') | ||
return datetime.datetime.strptime(text + " " + | ||
("AM" if int(text.split(":")[0]) >= 8 else "PM"), '%I:%M %p') | ||
return datetime.datetime.strptime(text + " " + | ||
("AM" if int(text) >= 8 else "PM"), '%I %p') | ||
|
||
def get_date_time(day,time): | ||
|
||
def get_date_time(day, time): | ||
""" | ||
Maps words like now today tom etc., to corresponding datetime objects | ||
""" | ||
try:time = mapping[time] | ||
try: | ||
time = mapping[time] | ||
except KeyError: | ||
if not time: | ||
time = datetime.datetime.now() | ||
else: | ||
time = try_parsing_date(time) | ||
try:date = mapping[day] | ||
except KeyError:date = datetime.date.today() | ||
try: | ||
date = mapping[day] | ||
except KeyError: | ||
date = datetime.date.today() | ||
|
||
return datetime.datetime.combine(date, time.time()) |
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
models/nlu/default/model_20181001-224630/entity_synonyms.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"10 pm": "tomorrow 10 PM", | ||
"tommorrow": "tomorrow", | ||
"tomorrow": "2", | ||
"6:30 pm": "10 AM", | ||
"6 am": "10 AM", | ||
"6 30 pm": "10 AM", | ||
"after": "before" | ||
} |
Binary file added
BIN
+143 KB
models/nlu/default/model_20181001-224630/intent_classifier_sklearn.pkl
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"rasa_nlu_version": "0.13.5", | ||
"trained_at": "20181001-224630", | ||
"pipeline": [ | ||
{ | ||
"case_sensitive": false, | ||
"name": "nlp_spacy", | ||
"model": "en", | ||
"class": "rasa_nlu.utils.spacy_utils.SpacyNLP" | ||
}, | ||
{ | ||
"name": "tokenizer_spacy", | ||
"class": "rasa_nlu.tokenizers.spacy_tokenizer.SpacyTokenizer" | ||
}, | ||
{ | ||
"name": "intent_featurizer_spacy", | ||
"class": "rasa_nlu.featurizers.spacy_featurizer.SpacyFeaturizer" | ||
}, | ||
{ | ||
"name": "intent_entity_featurizer_regex", | ||
"class": "rasa_nlu.featurizers.regex_featurizer.RegexFeaturizer", | ||
"regex_file": "regex_featurizer.json" | ||
}, | ||
{ | ||
"L2_c": 0.1, | ||
"max_iterations": 50, | ||
"L1_c": 0.1, | ||
"class": "rasa_nlu.extractors.crf_entity_extractor.CRFEntityExtractor", | ||
"name": "ner_crf", | ||
"classifier_file": "crf_model.pkl", | ||
"BILOU_flag": true, | ||
"features": [ | ||
[ | ||
"low", | ||
"title", | ||
"upper" | ||
], | ||
[ | ||
"bias", | ||
"low", | ||
"prefix5", | ||
"prefix2", | ||
"suffix5", | ||
"suffix3", | ||
"suffix2", | ||
"upper", | ||
"title", | ||
"digit", | ||
"pattern" | ||
], | ||
[ | ||
"low", | ||
"title", | ||
"upper" | ||
] | ||
] | ||
}, | ||
{ | ||
"name": "ner_synonyms", | ||
"synonyms_file": "entity_synonyms.json", | ||
"class": "rasa_nlu.extractors.entity_synonyms.EntitySynonymMapper" | ||
}, | ||
{ | ||
"kernels": [ | ||
"linear" | ||
], | ||
"classifier_file": "intent_classifier_sklearn.pkl", | ||
"class": "rasa_nlu.classifiers.sklearn_intent_classifier.SklearnIntentClassifier", | ||
"C": [ | ||
1, | ||
2, | ||
5, | ||
10, | ||
20, | ||
100 | ||
], | ||
"max_cross_validation_folds": 5, | ||
"scoring_function": "f1_weighted", | ||
"name": "intent_classifier_sklearn" | ||
} | ||
], | ||
"language": "en", | ||
"training_data": "training_data.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
Oops, something went wrong.