Spaces:
Runtime error
Runtime error
Greg Thompson
commited on
Commit
·
05bcb80
1
Parent(s):
adc9dc1
Update message_data object to use different versions of @event
Browse files- mathtext_fastapi/nlu.py +15 -1
mathtext_fastapi/nlu.py
CHANGED
|
@@ -57,7 +57,21 @@ def run_sentiment_analysis(message_text):
|
|
| 57 |
|
| 58 |
|
| 59 |
def evaluate_message_with_nlu(message_data):
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
message_text_arr = re.split(", |,| ", message_text.strip())
|
| 62 |
|
| 63 |
# TODO: Replace this with appropriate utility function (is_int, is_float, render_int_or_float)
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
def evaluate_message_with_nlu(message_data):
|
| 60 |
+
# Keeps system working with two different inputs - full and filtered @event object
|
| 61 |
+
try:
|
| 62 |
+
message_text = message_data['message_body']
|
| 63 |
+
except KeyError:
|
| 64 |
+
message_data = {
|
| 65 |
+
message_data['message']['_vnd']['v1']['chat']['owner'],
|
| 66 |
+
message_data['message']['_vnd']['v1']['author']['type'],
|
| 67 |
+
message_data['message']['_vnd']['v1']['chat']['contact_uuid'],
|
| 68 |
+
message_data['message']['text']['body'],
|
| 69 |
+
message_data['message']['_vnd']['v1']['direction'],
|
| 70 |
+
message_data['message']['id'],
|
| 71 |
+
message_data['message']['_vnd']['v1']['chat']['inserted_at'],
|
| 72 |
+
message_data['message']['_vnd']['v1']['chat']['updated_at'],
|
| 73 |
+
}
|
| 74 |
+
message_text = message_data['message_body']
|
| 75 |
message_text_arr = re.split(", |,| ", message_text.strip())
|
| 76 |
|
| 77 |
# TODO: Replace this with appropriate utility function (is_int, is_float, render_int_or_float)
|