-
Notifications
You must be signed in to change notification settings - Fork 0
/
facts.py
240 lines (183 loc) · 6.7 KB
/
facts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/usr/bin/env python
# -*- coding: utf8 -*-
# To communicate the client's desires to the intellect
class Goal(object):
UPDATE_EMAIL = "updateEmail"
WANT_ROOM = "wantRoom"
ESTABLISH_ROOM_TYPE = "roomType"
ESTABLISH_INIT_DATE = "initDate"
ESTABLISH_END_DATE = "endDate"
ESTABLISH_PENSION_TYPE = "pensionType"
CONFIRM_RESERVATION = "finishReservation"
ASK_SERVICE = "wantService"
SHOW_SUMMARY = "showSummary"
SHOW_ROOMS = "showRooms"
SHOW_POIS = "showPois"
GREET_USER = "greetUser"
DOUBLE_WITH_SEPARATED_BEDS = "doubleSeparated"
def __init__(self, id=None):
self._id = id
self._data = {}
@property
def id(self):
return self._id
@id.setter
def id(self, value):
self._id = value
@property
def data(self):
return self._data
@data.setter
def data(self, value):
self._data = value
def is_goal(self):
return self.id == Goal.ESTABLISH_ROOM_TYPE
# To extract the intellect response
class Response(object):
GREETINGS = ["Saludos", "Bienvenido", "Hola"]
ASK_ROOM_TYPE = "¿Que tipo de habitacion quieres?"
ASK_INIT_DATE = "¿Que dia quieres comenzar tu estancia?"
ASK_END_DATE = "¿Hasta que dia quieres estar?"
ASK_PENSION_TYPE = "¿Que tipo de pension prefieres?"
SHOW_INTRO_SUMMARY = "Los datos de la reserva son los siguientes:"
ASK_WRONG_INFO = "Bueno... ¿que quieres cambiar entonces?"
ASK_SERVICES = ["¿Estas interesado en alguno de nuestros servicios?",
"Disponemos de camas supletorias, parking y minibar"]
# , "Además te puedo hablar de lugares cercanos que te puedan ser de interes"
FINISH_RESERVATION = "Perfecto, guardo la reserva. Gracias por usar nuestros servicios."
ASK_EMAIL = "¿Cual es tu direccion de correo electronico? (para enviarte el resumen de la reserva)"
SHOW_ROOMS = "Disponemos de los siguientes tipos de habitacion:"
NO_INIT_DATE = "Lo siento, pero no tenemos {type} disponibles para esa fecha"
CONFIRM_ROOM_TYPE = "Una {room_type} pues"
CHANGE_ROOM_TYPE = "Tenia apuntada una {room_type}... cambio a una {new_room_type}"
CONFIRM_INIT_DATE = "Fecha de entrada para el {date}..."
CONFIRM_END_DATE = "Fecha de salida para el {date}..."
CONFIRM_PENSION_TYPE = "Bien, {pension_type} entonces"
CONFIRM_BASIC = "Esta todo correcto?"
UNKNOWN_INPUT = "Perdona, pero no te he entendido"
KNOWN_INFO = "Ya, ya me lo habias comentado"
TOTAL_PRICE = "Precio total: {price} EUR"
SERVICE_ADDITIONAL_BED = "Añado una cama supletoria"
SERVICE_PARKING = "Añado el servicio de parking"
SERVICE_MINIBAR = "El minibar se cobrará en función de las bebidas que se consuman en la habitacion (2 EUR por bebida)"
SERVICE_MORE = "¿Algo mas?"
SERVICE_WHAT = "¿De que servicios quiere disponer?"
KEYBOARD_ROOM_TYPES = "keyboardRoomTypes"
KEYBOARD_PENSION_TYPES = "keyboardPensionTypes"
POIS_PLACES = "Estos son algunos lugares que te pueden interesar y están cerca del hotel"
ACTION_SHOW_ROOMS = "showRooms"
DOUBLE_WITH_SEPARATED_BEDS = ["Actualmente no disponemos de ese tipo de habitaciones",
"En su lugar puedes coger dos individuales o seleccionar posteriormente una cama supletoria"]
def __init__(self, msg=[], keyboard=None, next_question=True, action=None):
msg = [msg] if type(msg) is str else msg
self._msg = []
for m in msg:
if type(m) is list:
self._msg += m
else:
self._msg.append(m)
self._keyboard = keyboard
self._next_question = next_question
self._action = action
def merge(self, resp):
for text in resp.msg:
self._msg.append(text)
if self.keyboard is None and resp.keyboard is not None:
self.keyboard = resp.keyboard
return self
def append(self, new):
if type(new) is str:
self._msg.append(new)
else:
for text in new:
self._msg.append(text)
@property
def msg(self):
return self._msg
@msg.setter
def msg(self, value):
self._msg = value
@property
def keyboard(self):
return self._keyboard
@keyboard.setter
def keyboard(self, value):
self._keyboard = value
@property
def next_question(self):
return self._next_question
@next_question.setter
def next_question(self, value):
self._next_question = value
@property
def action(self):
return self._action
@action.setter
def action(self, value):
self._action = value
class Reservation(object):
def __init__(self):
self._room_type = None
self._pension_type = None
self._init_date = None
self._end_date = None
self._parking = False
self._additional_bed = False
self._weather = None
@property
def room_type(self):
return self._room_type
@room_type.setter
def room_type(self, value):
self._room_type = value
@property
def pension_type(self):
return self._pension_type
@pension_type.setter
def pension_type(self, value):
self._pension_type = value
@property
def init_date(self):
return self._init_date
@init_date.setter
def init_date(self, value):
self._init_date = value
@property
def end_date(self):
return self._end_date
@end_date.setter
def end_date(self, value):
self._end_date = value
@property
def parking(self):
return self._parking
@parking.setter
def parking(self, value):
self._parking = value
@property
def additional_bed(self):
return self._additional_bed
@additional_bed.setter
def additional_bed(self, value):
self._additional_bed = value
@property
def weather(self):
return self._weather
@weather.setter
def weather(self, value):
self._weather = value
def summary(self):
summ = ""
if self.room_type is not None:
summ += "Tipo de habitacion: %s\n" % self.room_type
if self.init_date is not None:
summ += "Fecha de entrada: %s\n" % self.init_date
if self.end_date is not None:
summ += "Fecha de salida: %s\n" % self.end_date
if self.pension_type is not None:
summ += "Tipo de pension: %s\n" % self.pension_type
summ += "Cama supletoria: %s\n" % ("Si" if self.additional_bed else "No")
summ += "Parking: %s\n" % ("Si" if self.parking else "No")
if self.weather is not None:
summ += "Prevision meteorologica: %s\n " % self.weather
return summ