Add new rule 'exists'
Rule is satisfied if the entry exists in the data field not taking into
account it's value at all:
Example:
{
"utterance": "set an alarm on july 4th 2016 at 3pm",
"evaluation_timeout": 10,
"assert": "[['and', ['exists', 'ampm'], ['exists', 'time'] ]]"
}
@@ -367,6 +367,10 @@ class EvaluationRule(object):
self._get_field_value(rule[1], msg).endswith(rule[2])):
return False
+ if rule[0] == 'exists':
+ if not self._get_field_value(rule[1], msg):
+ return False
+
if rule[0] == 'match':
if not (self._get_field_value(rule[1], msg) and
re.match(rule[2], self._get_field_value(rule[1], msg))):
